Skip to content
Fix Code Error

How do you push a tag to a remote repository using Git?

March 13, 2021 by Code Error
Posted By: Anonymous

I have cloned a remote Git repository to my laptop, then I wanted to add a tag so I ran

git tag mytag master

When I run git tag on my laptop the tag mytag is shown. I then want to push this to the remote repository so I have this tag on all my clients, so I run git push but I got the message:

Everything up-to-date

And if I go to my desktop and run git pull and then git tag no tags are shown.

I have also tried to do a minor change on a file in the project, then push it to the server. After that I could pull the change from the server to my Desktop computer, but there’s still no tag when running git tag on my desktop computer.

How can I push my tag to the remote repository so that all client computers can see it?

Solution

git push --follow-tags

This is a sane option introduced in Git 1.8.3:

git push --follow-tags

It pushes both commits and only tags that are both:

  • annotated
  • reachable (an ancestor) from the pushed commits

This is sane because:

  • you should only push annotated tags to the remote, and keep lightweight tags for local development to avoid tag clashes. See also: What is the difference between an annotated and unannotated tag?
  • it won’t push annotated tags on unrelated branches

It is for those reasons that --tags should be avoided.

Git 2.4 has added the push.followTags option to turn that flag on by default which you can set with:

git config --global push.followTags true

or by adding followTags = true to the [push] section of your ~/.gitconfig file.

Answered By: Anonymous

Related Articles

  • VUE Error when run test unit
  • How can I find the location of origin/master in git,…
  • Why call git branch --unset-upstream to fixup?
  • Why do I have to "git push --set-upstream origin "?
  • Does "git fetch --tags" include "git fetch"?
  • Git workflow and rebase vs merge questions
  • Android Studio 4.2.1 NullPointer Exception on startup
  • c++ read file in binary mode into object failed but…
  • “tag already exists in the remote" error after…
  • Git - Pushing code to two remotes
  • What is git tag, How to create tags & How to…
  • How to properly do JSON API GET requests and assign…
  • How to prevent scrolling the whole page?
  • Git Using Remote Branch
  • Why do git fetch origin and git fetch : behave differently?
  • What exactly does the "u" do? "git push -u origin…
  • Why does Git say my master branch is "already up to…
  • Push git commits & tags simultaneously
  • How to pull in changes from skeleton sub-repository…
  • How do you get git to always pull from a specific branch?
  • Rename master branch for both local and remote Git…
  • What is "git remote add ..." and "git push origin master"?
  • A couple of problems with instant search and list…
  • npm ERR! fetch failed status code 502
  • How can I create a custom element in Aurelia when…
  • What's the difference between git clone --mirror and…
  • Start redis-server with config file
  • Group array of objects by multiple keys using d3.groups
  • Why does git say "Pull is not possible because you…
  • unable to deploy next js to azure
  • Change a Git remote HEAD to point to something…
  • How do I make a Git commit in the past?
  • Your configuration specifies to merge with the from…
  • Git push won't do anything (everything up-to-date)
  • D3 chart integration into Vuejs
  • Git merge with force overwrite
  • jQuery - getting custom attribute from selected option
  • What are the differences between git remote prune,…
  • How do I add files and folders into GitHub repos?
  • Unable to invoke another service with Dapr
  • Next JS code inside getInitialProps not executes…
  • Check if pull needed in Git
  • render function or template not defined in…
  • Various ways to remove local Git changes
  • Custom date picker in Vuetify
  • How can I find the product GUID of an installed MSI setup?
  • How to track untracked content?
  • Git push: "fatal 'origin' does not appear to be a…
  • git lfs push to github failure on Ubuntu 18.04
  • Getting the difference between two Dates…
  • What is a tracking branch?
  • Convert Java Date to UTC String
  • Watch $route.params.slug doesn't triggered vuejs
  • What's the difference between including files with…
  • Remove local git tags that are no longer on the…
  • Neither BindingResult nor plain target object for…
  • How does origin/HEAD get set?
  • How to install Intellij IDEA on Ubuntu?
  • How to convert java.util.Date to java.sql.Date?
  • git pull from master into the development branch
  • Rebasing remote branches in Git
  • How is TeamViewer so fast?
  • How to fetch all Git branches
  • Git push error: "origin does not appear to be a git…
  • Detach (move) subdirectory into separate Git repository
  • Push on GIT and Bitbucket
  • Moving away from bower in 2.15.1 ember-cli version
  • Git's famous "ERROR: Permission to .git denied to user"
  • How To Edit Date and Time Picker Vuejs Vuetify From…
  • Git branching: master vs. origin/master vs.…
  • Why does Git tell me "No such remote 'origin'" when…
  • git pull while not in a git directory
  • Command to get latest Git commit hash from a branch
  • The number of method references in a .dex file…
  • How do I delete a Git branch locally and remotely?
  • What is the best (and safest) way to merge a Git…
  • GIT clone repo across local file system in windows
  • How do I clone a single branch in Git?
  • Setting up and using Meld as your git difftool and mergetool
  • Ember Data hasMany async observed property "simple" issue
  • Finding a branch point with Git?
  • In Git, what is the difference between origin/master…
  • Git, How to reset origin/master to a commit?
  • git: updates were rejected because the remote…
  • Checkout another branch when there are uncommitted…
  • Git submodule update
  • discord.ext.commands.errors.CommandInvokeError:…
  • Why is Git better than Subversion?
  • How can I duplicate slots within a Vuejs render function?
  • How do I rename both a Git local and remote branch name?
  • Route's Model Hook with Ember Data "filter" not…
  • Git reset --hard and push to remote repository
  • Git: Create a branch from unstaged/uncommitted…
  • How to clone ('fork') your own personal GitHub repo…
  • git pull remote branch cannot find remote ref
  • Retrieve specific commit from a remote Git repository
  • Remove sensitive files and their commits from Git history
  • OperationalError, no such column. Django
  • Is this request generated by EF Core buggy or is it my code?
  • Git Push error: refusing to update checked out branch

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:

PostgreSQL “DESCRIBE TABLE”

Next Post:

Convert java.util.Date to String

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