LoginSignup
14
13

More than 5 years have passed since last update.

ローカルのフォルダをgitのremoteとして設定したい(windows)

Last updated at Posted at 2017-03-02

自分のローカルにgitのremoteを設定して運用することになったのでメモ

普通だとgithubとかなんやら使うのに珍しいな...と思った

参考サイト様

参考サイト:Windows PCをGitのリモートリポジトリとして使用する方法

この記事はほぼ参考サイト様の内容と同じです。
非常に助かりました。ありがとうございます。

リモートの作成

なにはともあれ早速環境を構築

まずは、リモートなるファイルを作成する。(A)

その後、実際にリポジトリとして使用されるフォルダを作成する。(B)

大体↓の画像のイメージ
image

特に(B)はhogehoge.gitなど、最後に.gitがつくのが習慣なので、今回もそれに習っています。

後はコンソールを立ち上げて...

cd /
cd git_share/repo.git
git init --bare --shared=true # リポジトリの初期化
touch ./git-daemon-export-ok  # 公開用リポジトリに指定
git daemon --export-all --enable=receive-pack --base-path=/C/git_share # GITデーモンの起動

こうすることで、下記URLよりリモートリポジトリとしてアクセスできるらしい
git://<リモートリポジトリを構築したPCのIPアドレス>/test_remote_repository.git

おまけ

私のローカルにGITのリモートを作成したので、私は直接リモートを設定しています
具体的には以下のような感じ

git remote add origin /c/git_share/mine.git

PS C:\hogehoge> git remote -v
origin  /c/git_share/repo.git (fetch)
origin  /c/git_share/repo.git (push)
14
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
13