What are the tags that end with '^{}'? They don't actually exist in the bare repository.
$ git ls-remote -t origin
55f09717db93733b8f151763e7e28628f3f22129 refs/tags/Init
dce13158fff0e95b8adcc5628f193a8c03bada9c refs/tags/Init^{}
2c9f64c306aa76e5b689bc2ffb41163aa255ac40 refs/tags/kaos-red
0970feca84d87df60ec5e943da2f55f1947fd0a3 refs/tags/legacy
dce13158fff0e95b8adcc5628f193a8c03bada9c refs/tags/legacy^{}
When I try to delete them with "git push :legacy^{}" for example, git responds
fatal: remote part of refspec is not a valid name in :Init^{}
So where are they coming from? Is it a bug in ls-remote?
The git rev-parse manual describes the various ways you can specify commits or other objects in git. For this case it says:
^{}, e.g. v0.99.8^{} A suffix ^ followed by an empty brace pair means the object could be a tag, and dereference the tag recursively until a non-tag object is found.
I wanted to bulk delete tags in my remote git repository, in some result documents I found from Google, I found the command like
git ls-remote --tag | awk '/(.*)(\s+)(.*)/ {print ":" $2}' | xargs git push origin
or something like that. (the same problem it will show phantom tags ending with ^{})
If you want to do the same thing like me, you can try to use the git command show-ref
git show-ref --tag | awk '/(.*)(\s+)(.*)/ {print ":" $2}' | xargs git push origin
In the latter way, you will not be blocked by this problem.
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