Skip to content
Fix Code Error

How to delete a remote tag?

March 13, 2021 by Code Error
Posted By: Anonymous

How do you delete a Git tag that has already been pushed?

Solution

You can push an ’empty’ reference to the remote tag name:

git push origin :tagname

Or, more expressively, use the --delete option (or -d if your git version is older than 1.8.0):

git push --delete origin tagname

Note that git has tag namespace and branch namespace so you may use the same name for a branch and for a tag. If you want to make sure that you cannot accidentally remove the branch instead of the tag, you can specify full ref which will never delete a branch:

git push origin :refs/tags/tagname

If you also need to delete the local tag, use:

git tag --delete tagname

Background

Pushing a branch, tag, or other ref to a remote repository involves specifying "which repo, what source, what destination?"

git push remote-repo source-ref:destination-ref

A real world example where you push your master branch to the origin’s master branch is:

git push origin refs/heads/master:refs/heads/master

Which because of default paths, can be shortened to:

git push origin master:master

Tags work the same way:

git push origin refs/tags/release-1.0:refs/tags/release-1.0

Which can also be shortened to:

git push origin release-1.0:release-1.0

By omitting the source ref (the part before the colon), you push ‘nothing’ to the destination, deleting the ref on the remote end.

Answered By: Anonymous

Related Articles

  • Form field border-radius is not working only on the…
  • Trouble with boxes appearing/hiding based on selection
  • loop and eliminate unwanted lines with beautiful soup
  • Why do I have to "git push --set-upstream origin "?
  • Why call git branch --unset-upstream to fixup?
  • Generating a drop down list of timezones with PHP
  • Why do git fetch origin and git fetch : behave differently?
  • Difference between git checkout --track…
  • Git - Pushing code to two remotes
  • How to generate JAXB classes from XSD?
  • Git Using Remote Branch
  • What exactly does the "u" do? "git push -u origin…
  • Your configuration specifies to merge with the from…
  • How can I find the location of origin/master in git,…
  • How do I delete a Git branch locally and remotely?
  • error LNK2005: ✘✘✘ already defined in…
  • How does origin/HEAD get set?
  • What is a tracking branch?
  • Various ways to remove local Git changes
  • Checkout another branch when there are uncommitted…
  • “tag already exists in the remote" error after…
  • Adding Google Translate to a web site
  • What are the differences between git remote prune,…
  • What is "git remote add ..." and "git push origin master"?
  • How to recover stashed uncommitted changes
  • How can I reconcile detached HEAD with master/origin?
  • Git workflow and rebase vs merge questions
  • Git merge with force overwrite
  • Why does git perform fast-forward merges by default?
  • How do SO_REUSEADDR and SO_REUSEPORT differ?
  • How to solve Internal Server Error in Next.Js?
  • npm ERR! fetch failed status code 502
  • How do I rename both a Git local and remote branch name?
  • How can I switch to another branch in git?
  • Why did my Git repo enter a detached HEAD state?
  • Change a Git remote HEAD to point to something…
  • How do I make a Git commit in the past?
  • Why do I need to do `--set-upstream` all the time?
  • Push git commits & tags simultaneously
  • How do you stop tracking a remote branch in Git?
  • XMLHttpRequest cannot load ✘✘✘ No…
  • How does PHP 'foreach' actually work?
  • unable to deploy next js to azure
  • Retrieve specific commit from a remote Git repository
  • git lfs push to github failure on Ubuntu 18.04
  • Identifying and solving…
  • Remote branch is not showing up in "git branch -r"
  • hide select options using only css
  • How do you get git to always pull from a specific branch?
  • Why does Git say my master branch is "already up to…
  • Homebrew install specific version of formula?
  • Check if pull needed in Git
  • moving committed (but not pushed) changes to a new…
  • Merge, update, and pull Git branches without using checkouts
  • Git push won't do anything (everything up-to-date)
  • How to clone ('fork') your own personal GitHub repo…
  • Git fetch remote branch
  • Start redis-server with config file
  • How do I clone a single branch in Git?
  • Need to reset git branch to origin version
  • C++ template,typename and operator
  • How to pull in changes from skeleton sub-repository…
  • How to create the branch from specific commit in…
  • Setting up and using Meld as your git difftool and mergetool
  • What are the undocumented features and limitations…
  • How do I convert Word files to PDF programmatically?
  • In Jquery show selected a value from the searched…
  • Updates were rejected because the tip of your…
  • Git push: "fatal 'origin' does not appear to be a…
  • Cleaning up old remote git branches
  • What is git tag, How to create tags & How to…
  • git pull from master into the development branch
  • Logging best practices
  • In plain English, what does "git reset" do?
  • Why do I need to explicitly push a new branch?
  • Make: "nothing to be done for target" when invoking…
  • Detach (move) subdirectory into separate Git repository
  • How to download a branch with git?
  • Git: Merge a Remote branch locally
  • git pull while not in a git directory
  • How to fetch all Git branches
  • How to clone all remote branches in Git?
  • git pull remote branch cannot find remote ref
  • Update a local branch with the changes from a…
  • Why does git status show branch is up-to-date when…
  • How can I find the product GUID of an installed MSI setup?
  • Fix top buttons on scroll of list below
  • What is a NullReferenceException, and how do I fix it?
  • Git submodule update
  • Git's famous "ERROR: Permission to .git denied to user"
  • Git push rejected after feature branch rebase
  • master branch and 'origin/master' have diverged, how…
  • Rename master branch for both local and remote Git…
  • What's the difference between "git reset" and "git…
  • How do I add files and folders into GitHub repos?
  • How to filter a RecyclerView with a SearchView
  • How to modify existing, unpushed commit messages?
  • Specifying java version in maven - differences…
  • Why is processing a sorted array faster than…
  • Why does Git tell me "No such remote 'origin'" when…

Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.

Post navigation

Previous Post:

Make an existing Git branch track a remote branch?

Next Post:

How to find the sum of an array of numbers

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

.net ajax android angular arrays aurelia backbone.js bash c++ css dataframe ember-data ember.js excel git html ios java javascript jquery json laravel linux list mysql next.js node.js pandas php polymer polymer-1.0 python python-3.x r reactjs regex sql sql-server string svelte typescript vue-component vue.js vuejs2 vuetify.js

  • you shouldn’t need to use z-index
  • No column in target database, but getting “The schema update is terminating because data loss might occur”
  • Angular – expected call-signature: ‘changePassword’ to have a typedeftslint(typedef)
  • trying to implement NativeAdFactory imports deprecated method by default in flutter java project
  • What should I use to get an attribute out of my foreign table in Laravel?
© 2022 Fix Code Error