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
I also faced git tag: fatal: Failed to resolve 'HEAD' as a valid ref issue when I was missing -m in the following command.(during tag creation)
git tag: fatal: Failed to resolve 'HEAD' as a valid ref
git tag -a testtag 'test'
changing to
git tag -a testtag -m 'test'
fixed the issue