Jack
Jack

Reputation: 377

how to fix the would clobber existing tag problem

I've got myself into trouble with git tagging and now my build pipeline (semaphore) is broken with the following error message. Not sure how to get this resolved.

Error message

Unpacking 
objects: 100% (32/32), done.
From github.com:jack/my-app
   c8a2420..75ea515  develop         -> origin/develop
   b4069ce..9f672e1  feature/RY-1144 -> origin/feature/RY-1144
   8dbf387..ac9db9d  master          -> origin/master
 ! [rejected]        v1.46.0         -> v1.46.0  (would clobber existing tag)
 * [new tag]         v1.47.0         -> v1.47.0

Update

I'm using visual code with some extensions and looking at the history of repo within visual code it looks like the tag can be deleted? If I click on the 'x' next to the tag 'v1.46.0' and then commit and push (with follow follow-tags) will this resolve my problem?

git history

Upvotes: 6

Views: 10216

Answers (3)

LeGEC
LeGEC

Reputation: 52196

The cause is : tag v1.46.0 on your remote does not point at the same commit as tag v1.46.0 on the local clone (local to your CI server).


a. Check that the v1.46.0 tag points at the right commit on the remote server (update it manually if needed),

b. Force update the tag(s) on the CI server by running one of the following two commands :

# to force update all tags :
git fetch --tags --force

# to force update only this specific tag :
git fetch origin -f v1.46.0:refs/tags/v1.46.0

Upvotes: 17

user9522358
user9522358

Reputation: 21

In general you can use git tag -l to show your local git tag, then git tag -d <tag_name> to delete the error tag.
In your particular case, you need to use git tag -d v1.46. to solve your problem.

Upvotes: 2

Jack
Jack

Reputation: 377

This was resolved by running the following command to delete the offending tag on the remote

git push --delete origin v1.46.0

Upvotes: 0

Related Questions