I am cloning a single branch from a repository and creating a tag in a python script. The commands are as follows.
git clone -b master --single-branch <repository adress>
git tag -a testag -m 'test'
It clones successfully but when it comes to adding the tag, it breaks with the following error:
fatal: Failed to resolve 'HEAD' as a valid ref.
I ran into the same issue and was able to fix it by changing from
git tag -a testtag -m 'test'
to
git tag -a testtag -m "test"
I was running in Windows 7. Hope this helps :-)
I had the same issue. You have to commit first before tagging
git commit
because you put tags on commits. So when there is no commit (like in your situation), you can't create a tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With