Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate Tag on Remote

We are using Bitbucket as our remote for a git repository, and we somehow ended up with a duplicate tag (which I didn't think was possible).

When I try:

git push --delete origin refs/tags/mytagName

I get:

error: dst refspec refs/tags/mytagName matches more than one.
error: failed to push some refs to 'https://[email protected]/[etc]'

I can see both tags in the bitbucket UI, but (as far as I can tell) it does not have a feature that allows delete tags.

Any way of correcting this?

Edit to answer some comment questions:

How do you observe duplicate tags? Using git log or some sort of a GUI?

I can see the tags in the BitBucket UI. I can also see the tags in my local git client (GitExtensions).

@torek: the duplicate tags do not have "^{}" in their name.

@torek and @Leon: the duplicate tag does appear twice in .git/packed-refs. They show up as:

refs/tags/refs/tags/mytagName
refs/tags/mytagName
like image 689
Phil Sandler Avatar asked Sep 13 '25 14:09

Phil Sandler


1 Answers

The comments above led me to the answer.

As noted in my edited question, the tag appeared twice in .git/packed-ref:

refs/tags/refs/tags/mytagName
refs/tags/mytagName

The following command deleted one of the tags:

git push --delete origin refs/tags/refs/tags/mytagName

I'm not clear on why "refs/tags" was duplicated, or how it got into the repo that way to begin with.

like image 116
Phil Sandler Avatar answered Sep 16 '25 07:09

Phil Sandler