Cannot delete GIT tag because of special character "Ã"
In a similar case I used combination of echo
and xargs
as follows to delete bad tag containing wrong unicode character \u0083
:
echo -e '\u0083release-1.7.5-hotfix1' |xargs git tag -decho -e '\u0083release-1.7.5-hotfix1' |xargs push --delete origin
In order to stop receiving tag 'xxÃxx'
as a new tag at every pull/fetch. I've made a clone of the repository.
I did not find a solution on how to actually delete the tag, but this is acceptable for me.
Special thanks to @VonC.
I'm probably just too stubborn, but I wanted to find a solution that doesn't involve deleting the repo and cloning it again - so here it is.
My bad tag was ◊v2.2.29.
Adding a ref in .git/packed-refs did the trick for me.Just duplicate (or add) a line in the packed-refs file and change the tag to your problematic one, in the format:
1ea677c29c1db49a284b3a0b44a5e96fda873da2 refs/tags/◊v2.2.29
You don't need to know the real object id for that tag, but you do need a valid one from your project. In my example 1ea677c29c1db49a284b3a0b44a5e96fda873da2 is just an object id of a different tag I had (it doesn't matter which of course - just pick one from a different line in the same file), and the issue is resolved.
Side note:If you give an object id that doesn't exist at all git will either complain it's invalid or just keep treating it as a new tag, depending on whether you got the structure right or not.