【发布时间】:2017-05-15 17:00:38
【问题描述】:
我正在尝试按照一些步骤为 GitHub 上的存储库做出贡献,但其中一个步骤不起作用。步骤在这里:https://github.com/wdbm/qTox/blob/master/CONTRIBUTING.md#how-to-open-a-pull-request。
我在 GitHub 上 fork 存储库。
我克隆了存储库:
git clone https://github.com/<YOUR_USER>/qTox.git
我访问本地仓库的目录:
cd qTox
我添加上游远程以便能够从上游存储库中获取:
git remote add upstream https://github.com/qTox/qTox.git
我尝试将本地 master 分支指向上游存储库:
git branch master --set-upstream-to=upstream/master
此命令失败并显示以下错误消息:
error: the requested upstream branch 'upstream/master' does not exist
hint:
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint:
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
我应该如何解决这个错误?我正在使用 Git 2.9.3。
【问题讨论】:
-
您是否按照提示运行了“git fetch”?还有,你在当地的哪个分公司?
-
@zim 感谢您的建议。我尝试运行
git fetch,但运行git branch master --set-upstream-to=upstream/master时仍然出现相同的错误。我正在尝试遵循here 描述的步骤。 -
你能显示这两个命令的输出:“git status”和“git remote -v”吗?
-
不错,看起来不错。在此处查看接受的答案:stackoverflow.com/questions/22080952/…
-
@zim 对不起,我迷路了。当我尝试文档中的下一步 (
git fetch upstream master:master) 时,我收到错误消息“致命:拒绝获取非裸存储库的当前分支 refs/heads/master”,这听起来不正确。
标签: git