[ZZ]git pull 的时候总提示出错


git pull的默认地址

当git clone之后,直接git pull它会自动匹配一个正确的remote url


[text] [branch “master”] remote = origin merge = refs/heads/master [/text]

  1. git处于master这个branch下时,默认的remote就是origin;
  2. 当在master这个brach下使用指定remote和merge的git pull时,使用默认的remote和merge。

如果直接运行git pull,会得到如此结果:

[bash] $ git pull Password: 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 ; ;‘). 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 “;“] url = ; fetch = ;

See git-config(1) for details. [/bash]


Note: at this point your repository is not setup to merge from the remote branch when you type ‘git pull’. You can either freshly ‘clone’ the repository (see “Developer checkout” below), or configure your current repository this way:

[bash] git remote add -f origin login@git.sv.gnu.org:/srv/git/project.git git config branch.master.remote origin git config branch.master.merge refs/heads/master [/bash]

因此通过git config进行如下配置:
[bash] $ git config branch.master.remote origin $ git config branch.master.merge refs/heads/master [/bash]



  1. How do you get git to always pull from a specific branch? - Stack Overflow
  2. Maintenance Docs UsingGit