initしてremote addするのとcloneするのの違い

gitのリポジトリを最初につくるとき、リモートリポジトリを最初に作ったあと、

$ git init
$ git remote add origin <repos>

ってやるのと

$ git clone <repos>

ってのがある。

remote add したとき、pullしようとすると

$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.

If you often merge with the same branch, you may want to
use 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

とかでた。

sugyanが書いてた。
Gitもまだよく分かっていない - すぎゃーんメモ

cloneしたときはうまい具合に設定してくれるらしいけど、remote addした場合は設定されてないのpullでエラる。.git/configとかを見比べればわかる。

remote addの場合は自分で設定する。

$ git config branch.master.merge refs/heads/master
$ git config branch.master.remote origin

もしくは設定しなくても

$ git pull origin master

でも可。