Alex Rivera | Logout

git fatal:No tags can describe <sha1 number>

Asked 2011-06-22T19:05:49.620
45

I am using tags by applying them to nightly builds. Then later, I want to use the output of describe --tags --match <latest tag> to tell me how far from the nightly build my images are. This is for QA testing.

I just ran into an error in a clone that is older than the current tag. I ran git fetch --tags, so I see the tag in git tag output, but when I run git describe --tags --match <tagname>, I get fatal: No tags can describe <head sha1 version number>. I cannot do a git pull to update the workspace at this point. Why does this happen and is there a workaround? Thanks very much

Edit
Report

1 Answer

14

It happens because you only fetch the tag, not the commit history of the tag. git describe uses this history, which is why it has an error.

The only workaround is to fetch repo's history containing the tag you're interested in, using git fetch <remote-name>.

answered 2011-06-22T19:15:31.380

Your Answer