リポジトリ作成(リモートとの連動)
ローカルのリポジトリとリモートのリポジトリを連動させる方法について記述
1. リモートリポジトリの作成
以下、リモートサーバで実施。(/organization)
$ mkdir sample-repo.git $ sample-repo.git $ git --bare init --share
※サーバ管理者ではなくて、リポジトリを作成できる権限がある場合はWeb上で実施
2. ローカルリポジトリの作成 以下はローカルで実施。
$ mkdir sample-repo $ cd sample-repo $ git init $ git add . $ git commit -m "initial commit"
3. ローカルリポジトリとリモートリポジトリの連動
$ git remote add origin http://git.remote.host/organization/sample-repo.git $ git config branch.master.remote origin $ git config branch.master.merge refs/heads/master $ git pull $ git push
(ご参考)
4. リモートリポジトリ変更
$ git remote set-url origin git@git.example.com:foo/bar.git