Git:致命:不明确的对象名称:'origin/release_2.6'
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3782893/
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
Git : fatal: Ambiguous object name: 'origin/release_2.6'
提问by stellard
I am getting this error when trying to create a remote tracking branch
尝试创建远程跟踪分支时出现此错误
git co -b release_2.6 origin/release_2.6
warning: refname 'origin/release_2.6' is ambiguous.
warning: refname 'origin/release_2.6' is ambiguous.
fatal: Ambiguous object name: 'origin/release_2.6'.
I only have these two refs defined with release_2.6
我只用 release_2.6 定义了这两个参考
git show-ref | grep "release_2.6"
a71b2da1526f73862464a23aceaa1939a8b1ace2 refs/heads/origin/release_2.6
ed1399936a8cc4cd2feed1851123af861b0ff093 refs/remotes/origin/release_2.6
Does anyone know what this error means?
有谁知道这个错误是什么意思?
Cheers
干杯
回答by max
If something can be found in both refs/heads/
and refs/remotes/
then this is ambiguous.
You have local branch origin/release_2.6
and remote tracking branch release_2.6
for remote origin
. Don't think you are supposed to have a refs/heads/origin/release_2.6
branch though. Anyway, you can specify full reference name to resolve ambiguity:
如果可以在两者中找到某些东西refs/heads/
,refs/remotes/
那么这是模棱两可的。你有当地分支机构origin/release_2.6
和远程跟踪分支release_2.6
远程origin
。不要认为你应该有一个refs/heads/origin/release_2.6
分支。无论如何,您可以指定完整的引用名称来解决歧义:
git co -b release_2.6 refs/remotes/origin/release_2.6
回答by bettisra1
I had similar error when I created a remote branch using git-svn. I had the remote branch and the local branch with same name. You can rename the local branch using
git branch -m old_branch new_name
This will just rename the local branch without changing the remote branch.
当我使用 git-svn 创建远程分支时,我遇到了类似的错误。我有同名的远程分支和本地分支。您可以使用重命名本地分支
git branch -m old_branch new_name
这只会重命名本地分支而不更改远程分支。
Shravan
什拉万
回答by nilesh
For me, it was just a dumb mistake. I accidentally created a branch named like the remote, like in this case I had a local branch like origin/release_2.6
:)
对我来说,这只是一个愚蠢的错误。我不小心创建了一个名为 remote 的分支,就像在这种情况下我有一个本地分支,例如origin/release_2.6
:)
回答by Liam
I had a similar error when I cloned an SVN repository with git-svn, but I had no "origin" in either path. I ended up with the following refs:
当我用 git-svn 克隆一个 SVN 存储库时,我遇到了类似的错误,但我在任一路径中都没有“来源”。我最终得到了以下参考:
0e4b5116f69200ea0d7a2ff9f0fa15630d02b153 refs/heads/development
0ef5969f7ee44b16817053bfe146c499be5f77b7 refs/remotes/development
and I was unable to branch; when I tried I would get the "ambiguous object name" error. My error was that when I did the original git svn clone, I did not specify a --prefix; the correct form was
我无法分支;当我尝试时,我会收到“不明确的对象名称”错误。我的错误是,当我做原始 git svn clone 时,我没有指定 --prefix;正确的形式是
git svn clone --prefix origin/ --stdlayout xxxx
and then I ended up with refs/remotes/origin/development, etc. and there was no problem branching. According to the man page, you must have the trailing slash on the prefix.
然后我最终得到了 refs/remotes/origin/development 等,并且分支没有问题。根据手册页,前缀上必须有斜杠。
Liam
利亚姆