I added a tag to the master branch on my machine:
git tag mytag master How do I push this to the remote repository? Running git push gives the message:
Everything up-to-date
However, the remote repository does not contain my tag.
To push a single tag:
git push origin tag <tag_name> And the following command should push all tags (not recommended):
# not recommended git push --tags git push --tags as it can be very very difficult to get rid of bad tags when your co-workers are trained to push all tags, as people continue to push the old bad tags they have locally every time they want to push a new tag. Because of this, I will only every advise someone to use git push origin <tag_name> now.git push origin <tag_name> --forcegit push fails with error: src refspec <tag_name> matches more than one., you can push it as git push origin tag <tag_name>git push --tags origin <tag_name> IS NOT what you want - despite naming a specific tag, it pushes them all, even lightweight ones. Sigh.git push --dry-run --tags origin to see what will get pushed.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:
This is sane because:
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.
To activate this in Visual Studio Code set the variable "git.followTagsWhenSync": true on a user or workspace basis. GitHub
git push origin --tags does.To push specific, one tag do following git push origin tag_name
Add a tag in your current branch. If you want to create the tag for your master, first check out to master.
git tag tag_name Check if it's created or not
git tag Push in your remote origin
git push origin tag_name To expand on Trevor's answer, you can push a single tag or all of your tags at once.
git push <remote> <tag> This is a summary of the relevant documentation that explains this (some command options omitted for brevity):
git push [[<repository> [<refspec>…]] <refspec>...The format of a
<refspec>parameter is…the source ref<src>, followed by a colon:, followed by the destination ref<dst>…The
<dst>tells which ref on the remote side is updated with this push…If:<dst>is omitted, the same ref as<src>will be updated…tag
<tag>means the same asrefs/tags/<tag>:refs/tags/<tag>.
git push --tags <remote> # Or git push <remote> --tags Here is a summary of the relevant documentation (some command options omitted for brevity):
git push [--all | --mirror | --tags] [<repository> [<refspec>…]] --tagsAll refs under
refs/tagsare pushed, in addition to refspecs explicitly listed on the command line.
tag. e.g. git push origin tag funny-tag-1.git push origin my-tag (I just tried it!)2.10.2. Maybe that's it?Tags are not sent to the remote repository by the git push command. We need to explicitly send these tags to the remote server by using the following command:
git push origin <tagname> We can push all the tags at once by using the below command:
git push origin --tags Here are some resources for complete details on git tagging:
How can I push my tag to the remote repository so that all client computers can see it?
Run this to push mytag to your git origin (eg: GitHub or GitLab)
git push origin refs/tags/mytag It's better to use the full "refspec" as shown above (literally refs/tags/mytag) just in-case mytag is actually v1.0.0 and is ambiguous (eg: because there's a branch also named v1.0.0).
In my case I am using Git version 2.30.0 I tried both --follow-tags and --tags, but both of them didn't work to push all the tags to the remote repo. I ended up using:
+refs/remotes/origin/tags/*:refs/tags/* So for those who are looking for a way to push all the tags (along with master) to a remote repo, you can just add the following +refs/remotes/origin/tags/*:refs/tags/* to your push command.
So your command should be something like this:
git push path/to/your/repo +refs/remotes/origin/tags/*:refs/tags/* It will successfully create all your tags in the remote repo.