无法使用 git pull “找不到远程引用 xxx”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21642694/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fail to use git pull "Couldn't find remote ref xxx"
提问by dj199008
I come up with a problem about git pull.
我想出了一个关于 git pull 的问题。
Firstly, I am in "test_http_1204" branch,
首先,我在“test_http_1204”分支,
root@inception-server-Quantal:~/bosh# git branch
master
* test_http_1204
ubuntu1204
Then I use git pull, and got an error message,
然后我使用 git pull,并收到一条错误消息,
root@inception-server-Quantal:~/bosh# git pull m109bosh test_http_1204
fatal: Couldn't find remote ref test_http_1204
Unexpected end of command stream
But, I can find branch "test_http_1204" in my remote repo "m109bosh",
但是,我可以在我的远程仓库“m109bosh”中找到分支“test_http_1204”,
root@inception-server-Quantal:~/bosh# git branch -a
master
* test_http_1204
ubuntu1204
remotes/m109bosh/master
remotes/m109bosh/patch-1
remotes/m109bosh/test_http_1204
remotes/m109bosh/ubuntu1204
remotes/origin/HEAD -> origin/master
remotes/origin/floating_dns_registry
remotes/origin/http_stemcell_uploader
remotes/origin/master
remotes/origin/squashed
remotes/origin/ubuntu1204
remotes/origin/upstream
And, the content of .git/config is shown below:
并且,.git/config 的内容如下所示:
root@inception-server-Quantal:~/bosh# cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://github.com/cloudfoundry-community/bosh-cloudstack-cpi.git
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "ubuntu1204"]
remote = origin
merge = refs/heads/ubuntu1204
[remote "m109bosh"]
url = https://github.com/m1093782566/bosh-cloudstack-cpi.git
fetch = +refs/heads/*:refs/remotes/m109bosh/*
url = https://github.com/m1093782566/bosh.git
I guess the root cause maybe the missing of [branch "test_http_1204"] in the .git/config, but when I add these lines to .git/config manually, it still does not work.
我想根本原因可能是 .git/config 中缺少 [branch "test_http_1204"],但是当我手动将这些行添加到 .git/config 时,它仍然不起作用。
[branch "test_http_1204"]
remote = m109bosh
merge = refs/heads/test_http_1204
I have no idea about that. Could you please tell me how to fix it? Thanks!
我不知道。你能告诉我如何解决吗?谢谢!
采纳答案by torek
Based on git ls-remote
output (was in comment, now gone - it doesn't fit very well in comments) it looks like the remote used tohave a branch named test_http_1024
, but no longer does.
根据git ls-remote
输出(在评论中,现在消失了 - 它在评论中不太适合)它看起来像遥控器曾经有一个名为 的分支test_http_1024
,但不再有。
In other words, whoever controls the remote did a git branch -d
(or something equivalent) to delete their branch test_http_1024
. This means that when you ask git pull
for the contents of that branch, all it can tell you is: "eh? what? what branch?" :-)
换句话说,控制遥控器的人做了git branch -d
(或类似的事情)删除了他们的 branch test_http_1024
。这意味着当您询问git pull
该分支的内容时,它只能告诉您:“嗯?什么?什么分支?” :-)
When you look at your own set of remote branches, you can see that they used tohave a branch test_http_1024
(which your git copied to remotes/m109bosh/test_http_1204
, back when it existed). But they can add or delete branches whenever they want.
当您查看自己的一组远程分支时,您可以看到它们曾经有一个分支test_http_1024
(您的 git 复制到该分支remotes/m109bosh/test_http_1204
,当它存在时返回)。但是他们可以随时添加或删除分支。
If you run git fetch -p m109bosh
or git remote update --prune m109bosh
, your own git will delete its (old, stale) copy of their test_http_1024
branch. (You might notwant to do this if you're still using it for something.)
如果您运行git fetch -p m109bosh
或git remote update --prune m109bosh
,您自己的 git 将删除其test_http_1024
分支的(旧的、陈旧的)副本。(您可能不希望如果你还在用它的东西要做到这一点。)
A perhaps more important issue is that in:
一个可能更重要的问题是:
[remote "m109bosh"]
url = https://github.com/m1093782566/bosh-cloudstack-cpi.git
fetch = +refs/heads/*:refs/remotes/m109bosh/*
url = https://github.com/m1093782566/bosh.git
there are two differenturl =
lines. Presumably one of them is out of date. (git fetch
uses the first one, so perhaps the second is the one you want.)
有两条不同的url =
线路。大概其中之一已经过时了。(git fetch
使用第一个,所以也许第二个是您想要的。)