我正在嘗試遵循一些步驟來貢獻GitHub上的存儲庫,並且其中一個步驟不起作用。步驟如下:https://github.com/wdbm/qTox/blob/master/CONTRIBUTING.md#how-to-open-a-pull-request。如何解決Git錯誤「所請求的上游分支'上游/主'不存在」
我在GitHub上存放倉庫。
我克隆庫:
git clone https://github.com/<YOUR_USER>/qTox.git
我訪問本地資源庫的目錄:
cd qTox
我添加上游遠程以便能夠從上游儲存庫來獲取:
git remote add upstream https://github.com/qTox/qTox.git
我嘗試將本地主分支指向上游存儲庫:
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。
你運行 「混帳取」,作爲提示說?還有,你在當地什麼分支? – zim
@zim感謝您的建議。我試着運行'git fetch',但是當我運行'git branch master --set-upstream-to = upstream/master'時,我仍然得到相同的錯誤。我試圖按照[這裏]描述的步驟(https://github.com/wdbm/qTox/blob/master/CONTRIBUTING.md#how-to-open-a-pull-request)。 – d3pd
你能顯示這兩個命令的輸出:「git status」和「git remote -v」嗎? – zim