`

设置git pull的默认地址

    博客分类:
  • git
git 
阅读更多
git pull origin master

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

是因为在config文件中配置了以下内容:

1 [branch "master"]
2 remote = origin
3 merge = refs/heads/master

在参考[2]中,有这样一段:

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:

1 git remote add -f origin login@git.sv.gnu.org:/srv/git/project.git
2 git config branch.master.remote origin
3 git config branch.master.merge refs/heads/master   

 

因此通过git config进行如下配置:

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

或者加上--global选项,对于全部项目都使用该配置。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics