我试图遵循一些步骤来贡献GitHub上的存储库,其中一个步骤不起作用.步骤如下:https://github.com/wdbm/qTox/blob/master/CONTRIBUTING.md#how-to-open-a-pull-request.
我在GitHub上分叉存储库.
我克隆了存储库:
git clone https://github.com/<YOUR_USER>/qTox.git
Run Code Online (Sandbox Code Playgroud)
我访问本地存储库的目录:
cd qTox
Run Code Online (Sandbox Code Playgroud)
我添加了上游远程,以便能够从上游存储库中获取:
git remote add upstream https://github.com/qTox/qTox.git
Run Code Online (Sandbox Code Playgroud)
我尝试将本地主分支指向上游存储库:
git branch master --set-upstream-to=upstream/master
Run Code Online (Sandbox Code Playgroud)
此命令失败,并显示以下错误消息:
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.
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个错误?我正在使用Git 2.9.3.
Von*_*onC 15
git fetch upstream master:master
:这项工作只有在你不在的时候master
.如果你在master
,简单git fetch upstream
就足够了.
然后,您可以将本地链接master
到远程跟踪分支upstream/master
(刚刚获取)
git branch -u upstream/master master
Run Code Online (Sandbox Code Playgroud)
然后你可以git pull
用来更新master
.
再说一遍,如果你不在master
,那么是的,git fetch upstream master:master
会起作用.
我有一个类似的问题,但git fetch
没有解决我的问题。另外,就我而言,我发现它git config --get remote.origin.fetch
没有返回任何东西,而它应该
我的问题是.git/config
相应远程块的提取行中的文件中有错字(可能是我之前错误添加的内容)。因此,请检查您的远程输入.git/config file
是否正确,例如:
[remote "origin"]
url = https://[server]/[user or organization]/[repo].git
fetch = +refs/heads/*:refs/remotes/origin/*
Run Code Online (Sandbox Code Playgroud)
您也可以直接删除并重新添加远程条目
归档时间: |
|
查看次数: |
13439 次 |
最近记录: |