5

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

Jack
  • 367
  • 1
  • 4
  • 14
  • Did you move the `v1.46.0` tag to a new commit? If so then you probably need to ask your build pipeline to clear out any caches and start from a fresh clone of your repository. – Lasse V. Karlsen Feb 28 '20 at 21:01
  • I don't know in truth what happened. Can the tag causing the problem just be deleted? – Jack Feb 29 '20 at 20:47
  • 1
    Does this answer your question? [How to get rid of "would clobber existing tag"](https://stackoverflow.com/questions/58031165/how-to-get-rid-of-would-clobber-existing-tag) – Hunter Tran Feb 11 '21 at 15:03

3 Answers3

15

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
LeGEC
  • 46,477
  • 5
  • 57
  • 104
  • I assume the table is saying the left column is local and the right column is the remote – Jack Feb 28 '20 at 16:23
  • The output mentions the branch/tags that were updated on the remote side (left column), and the references that will be updated on the local side (right column). – LeGEC Feb 28 '20 at 16:32
  • are you saying I can run the second line (and only the second line) and it will repoint the tag (v1.46.0) to the same commit on both local and remote? – Jack Feb 29 '20 at 23:03
  • @Jack : yes (better late than never :) ) – LeGEC Feb 11 '21 at 15:09
1

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.

Benjamin Zach
  • 1,452
  • 2
  • 18
  • 38
0

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

git push --delete origin v1.46.0
Jack
  • 367
  • 1
  • 4
  • 14