サーバに共有リポジトリを作る $ mkdir hoge$ cd hoge$ git init --bareリモートリポジトリ追加 $ git remote add origin ssh://example.com/home/kambara/git-repos/hoge$ git config remote.origin.urlリモートリポジトリ変更 $ git config remote.origin.url ../foobar Webアプリだとさらにサーバ側でgit cloneしておく $ git clone ~/git-repos/hoge空ディレクトリを追加するには.gitignoreを追加しておく $ mkdir hoge$ cd hoge$ touch .gitignore削除したファイルの復活。svnのようにupdateではできない。 $ git checkout <masterとかブランチ名> ファイル名はまった git pull しようとするとbranchを指定しろ、と言われる。 $ git pullYou asked me to pull without telling me which branch youwant to merge with, and 'branch.master.merge' inyour configuration file does not tell me, either. Pleasespecify which branch you want to use on the command line andtry again (e.g. 'git pull <repository> <refspec>').See git-pull(1) for details.If you often merge with the same branch, you may want touse something like the following in your configuration file: [branch "master"] remote = <nickname> merge = <remote-ref> [remote "<nickname>"] url = <url> fetch = <refspec>See git-config(1) for details.ちなみに $ git pull origin masterはできる。 .git/configを見ると、[remote "origin"]は指定されているが、[branch "master"]は指定されていない。 .git/configに以下を追記すると良い。 [branch "master"] remote = origin merge = refs/heads/master直接.git/configを編集してもよいが、コマンドラインでやるなら以下のようにする。 $ git config branch.master.remote origin$ git config branch.master.merge refs/heads/masterこれでgit pullできるようになった。 参考: |
