Making git tags available on a remote server

Written on May 12, 2016

Tagging in git is often used to mark release points in a repository. For example, at the end of every week on one of the repositories that I contribute to, we merge the development branch into the master branch. This master branch in turn gets push up to various production servers. By tagging the merge, we’re able to see all the changes that went in for the week.

Another example would be if you were creating your own Bower package. Bower requires you to use semvar Git tags to notify Bower of when a new version is created of your package.

The syntax to create git tags is simply:

git tag a.b.c

Where a.b.c is the version of your tag.

What I didn’t know about tags is, by default these tags are not pushed up to a remote server. Meaning they are only available locally. I had not known this so all the tags I’ve been creating thus far have never been pushed up to the remote server of my repository.

Thankfully there are two ways to push up tags to a remote server.

Push up a single tag

You can push up a single tag by using

git push origin a.b.c

Again, where a.b.c

If you aren’t sure which tags are available on your repo, simply run git tag to get a list.

Push up all the tags

If you’re like me and have been tagging milestones for a while and didn’t know the tags weren’t being pushed up to a remote server, you could use this second option which is to push all the tags at once.

git push origin --tags

For more git tagging information, check out the resource where I discovered my tags weren’t being pushed up to the remote server.

Stay in touch

Thanks for reading this article. I'd love to stay in touch and share more tips on programming and side projects with you. Sign up and I'll send you my articles straight to your email, you'll also get a free copy of the light themed version of my Git cheat sheet.
Git cheat sheet preview image