To delete a remote tag in Git, use one of these methods:
Method 1: Delete a Single Remote Tag
git push --delete origin <tag-name>
or the equivalent shorthand:
git push origin :refs/tags/<tag-name>
Example:
git push --delete origin v1.2.0
# or
git push origin :refs/tags/v1.2.0
Method 2: Delete Multiple Remote Tags
List tags separated by spaces:
git push --delete origin v1.2.0 v1.3.0
Step-by-Step Workflow
- Delete the remote tag (as shown above).
- (Optional) Delete the local tag (if it exists):
git tag -d <tag-name>
Verify Deletion
Check if the tag was removed from the remote:
git ls-remote --tags origin
Key Notes
- Replace
originwith your remote name (e.g.,upstream). - Git versions ≥1.7.0 support
--deletefor clarity. - If you see
remote: error: refusing to delete the current branch, double-check the tag name.
Why This Works
- The
git push --deletecommand removes the reference to the tag on the remote. - The
:refs/tags/<tag-name>syntax tells Git to push “nothing” to the tag’s location, effectively deleting it.