Senthil A Kumar
Senthil A Kumar

Reputation: 11184

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

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"

Upvotes: 15

Views: 7864

Answers (2)

Senthil A Kumar
Senthil A Kumar

Reputation: 11184

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

Upvotes: 14

funroll
funroll

Reputation: 37093

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.

Upvotes: 8

Related Questions