我有一个远程裸存储库hub。我只在master分行工作。下面这条错误消息的最后一句话让我想知道:我如何找出哪个是 “当前分支的默认配置远程” ?我该如何设置?
hub
master
[myserver]~/progs $ git remote -v hub ~/sitehub/progs.git/ (fetch) hub ~/sitehub/progs.git/ (push) [myserver]~/progs $ git branch -r hub/master [myserver]~/progs $ cat .git/HEAD ref: refs/heads/master [myserver]~/progs $ git pull hub You asked to pull from the remote 'hub', but did not specify a branch. Because this is not the default configured remote for your current branch, you must specify a branch on the command line.
跟踪远程分支
您可以使用 git-branch 的 track 选项指定用于推送和拉取的默认远程存储库。您通常通过在创建本地主分支时指定 –track 选项来执行此操作,但由于它已经存在,我们只需手动更新配置,如下所示:
编辑您的.git/config
.git/config
[branch "master"] remote = origin merge = refs/heads/master
现在你可以简单地 git push 和 git pull。
[来源]