Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

reference

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
ed1399936a8cc4cd2feed1851123af861b0ff093 refs/remotes/origin/release_2.6

Does anyone know what this error means?

Cheers

like image 910
stellard Avatar asked Sep 23 '10 22:09

stellard


5 Answers

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
like image 171
max Avatar answered Nov 14 '22 09:11

max


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

like image 45
bettisra1 Avatar answered Nov 14 '22 08:11

bettisra1


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

like image 8
nilesh Avatar answered Nov 14 '22 09:11

nilesh


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

like image 4
Liam Avatar answered Nov 14 '22 07:11

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
like image 1
Gayan Avatar answered Nov 14 '22 08:11

Gayan