How to Delete a Remote Git Tag?

Learn how to delete a remote git tag

In git v1.8.0+, to delete a tag from a specific remote, you can git push an empty reference to a remote tag by using the -d flag (or --delete):

# Git v1.8.0+
git push -d <remote-name> refs/tags/<tag-name>

In earlier versions of git, you can achieve the same by prefixing tag name with a colon (:):

git push <remote-name> :refs/tags/<tag-name>

You may omit the "refs/" (or even "refs/tags/") prefix from either command for a shorter syntax. However, it might be a good idea to prefix the tag name with "tags/" to a very minimum, to avoid accidentally removing a branch having the same name as a tag.

This won't delete the tag from your local. To do that you will have to additionally run the git tag -d <tag-name> command.

For example, to delete a tag called "v1.5.0" from the remote "origin", you would do something like the following:

# Git v1.8.0+
git push -d origin tags/v1.5.0

# Earlier versions
git push origin :tags/v1.5.0

Hope you found this post useful. It was published . Please show your love and support by sharing this post.