Reputation: 99
A tag was created that contains "Ã" in the name, I am unable to delete the tag tried the following:
git tag -d -- xxÃxx
git push origin :refs/tags/xxÃxx
git config --global core.precomposeunicode true
git tag -d -- xxÃxx
git push origin :refs/tags/xxÃxx
Tried also with double quote for the name.
When executing the commands git says that the tag was deleted: Local delete:
Deleted tag 'xxÃxx' (was 434eae7)
After push:
remote: warning: Allowing deletion of corrupt ref.
- [deleted] xxÃxx
Tag "xxÃxx" comes as new at every git fetch -p or git pull(event after two consecutive pulls).
Also tried to delete the tag from source tree but the tag appears again.
Upvotes: 7
Views: 1857
Reputation: 558
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 -d
echo -e '\u0083release-1.7.5-hotfix1' |xargs git push --delete origin
Upvotes: 4
Reputation: 157
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.
Upvotes: 1
Reputation: 99
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.
Upvotes: 1