Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git tags remain in Jenkins

I would like to delete all Git tags for my project, which I did using git tag -d for local tags and then I pushed that to origin, so the tags in origin are deleted as well.

Indeed, if I run git tag -l or git ls-remote --tags origin then no tag is displayed.

However, my build is set up such that whenever I push, a build is triggered in Jenkins. When the build is triggered on the machine running Jenkins, git tag -l does show several tags.

How can I delete those tags?

like image 518
octavian Avatar asked Mar 22 '17 17:03

octavian


People also ask

Can Git tags be removed?

Use Git to delete a Git tag To delete the Git tag from the local repo, run the git tag -d tag-name command where tag-name is the name of the Git tag you want to delete. To get a list of Git tag names, run git tag.

How are Git tags stored?

They are stored in the . git/refs/tags directory, and just like branches the file name is the name of the tag and the file contains a SHA of a commit 3. An annotated tag is an actual object that Git creates and that carries some information. For instance it has a message, tagger, and a tag date.

Are Git tags automatically pushed?

Sharing tags is similar to pushing branches. By default, git push will not push tags. Tags have to be explicitly passed to git push . To push multiple tags simultaneously pass the --tags option to git push command.

What happens on deleting Git tag?

By omitting the source ref (the part before the colon), you push 'nothing' to the destination, deleting the ref on the remote end. It is also interesting to know that git tag -d `git tag` will delete all local tags. Same applies for git push --delete origin `git tag` assuming you pulled the remote tags locally.


1 Answers

Another solution that helped me is to configure Jenkins temporarily to wipe out repository and make a force clone:

enter image description here

like image 122
briarheart Avatar answered Sep 21 '22 20:09

briarheart