Search code examples
gitgit-clone

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"

Solution

  • 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