开发者

Git : fatal: Ambiguous object name: 'origin/release_2.6'

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

git show-ref | grep "release_2.6"
a71b2da1526f73862464a23aceaa1939a8b1ace2 refs/heads/origin/release_2.6
ed1399936a8cc4cd2feed1851123开发者_开发知识库af861b0ff093 refs/remotes/origin/release_2.6

Does anyone know what this error means?

Cheers


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:

git co -b release_2.6 refs/remotes/origin/release_2.6


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.

Shravan


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 :)


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:

 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 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.

Liam


I got this error because I had a branch "develop" and a tag called "develop".

$ git tag
develop
master
staging
v0.0.1-test
v0.0.11

Deleting both the local tag and remote tag matching the branch name worked for me.

$ git tag -d develop
$ git push origin :refs/tags/develop
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜