Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git clone error warning: refname '' is ambiguous. Git normally never creates a ref that ends with 40 hex characters

Tags:

git

git-clone

Got this error during cloning

remote: warning: refname '4e810d87701e09df2949cb33e731052aa05d2c76' is ambiguous.
remote: Git normally never creates a ref that ends with 40 hex characters
remote: because it will be ignored when you just specify 40-hex. These refs
remote: may be created by mistake. For example,
remote: 
remote:   git checkout -b $br $(git rev-parse ...)
remote: 
remote: where "$br" is somehow empty and a 40-hex ref is created. Please
remote: examine these refs and maybe delete them. Turn this message off by
remote: running "git config advice.objectNameWarning false"
like image 427
Senthil A Kumar Avatar asked Dec 11 '13 04:12

Senthil A Kumar


2 Answers

During cloning I got this error message and found that a tag was created with this name (like a 40-hex ref).

When you get this error, you can look for branch or tag names with the ambiguous value and remove it if the ref is not required

$ git tag | grep 4e810d87701e09df2949cb33e731052aa05d2c76
4e810d87701e09df2949cb33e731052aa05d2c76

$ git tag -d 4e810d87701e09df2949cb33e731052aa05d2c76
like image 89
Senthil A Kumar Avatar answered Nov 13 '22 04:11

Senthil A Kumar


In my case it was a branch and not a tag.

To find if the ref is a tag or branch:

$ git branch -a | grep 4e810d87701e09df2949cb33e731052aa05d2c76
$ git tag | grep 4e810d87701e09df2949cb33e731052aa05d2c76

Be aware you might want to save the branch or tag before you delete it. (Using a different name, of course.)

Here's how I got rid of it:

$ git branch -d 4e810d87701e09df2949cb33e731052aa05d2c76
$ git push origin :4e810d87701e09df2949cb33e731052aa05d2c76

In my case the error only came up during a git clone --mirror--it wasn't a problem normally.

like image 22
funroll Avatar answered Nov 13 '22 06:11

funroll