tags:

views:

173

answers:

2

We have a repository with multiple tags. Each tag represents a version of the software. We are pushing the repository to a remote server.

When we do a fresh clone off the remote server, the tags are no longer there. How do you ensure other developers or clients can check out specific versions of software off the remote server?

+6  A: 

git push --tags or git push remote tag-name

Brian Campbell
It strikes me as odd that tags should be kept separate, i wonder why!
corydoras
Actually, tags are not kept separate. The default semantics of `git push` are to push refs (branches and tags) on your local machine that have matching refs on the remote. Since any given tag doesn't yet exist on the remote, it wouldn't be pushed (and as tags are intended to be immutable, it wouldn't really make sense to update the tags anyhow). So, you need to explicitly push tags when you want them to appear on the remote.
Brian Campbell
It might need to be, I think, `git push <remote> tag <tag-name>`, i.e. the repository parameter has to be specified explicitely (because interpretation depends on position).
Jakub Narębski
I don't think you have to explicitly write "tag", according to manpage it's just `git push <remote> <tag-name>` (or `git push <remote> tags/<tag-name>` to prevent conflict with other similarly-named refs.
che
You're right. I basically always use `git push --tags`, so I screwed up the syntax for an individual tag when checking the man page. I figured the reason for the `tag <tag-name>` syntax was to distinguish from a remote, but I guess it's basically useless (as `tag/<tag-name>` works just as well).
Brian Campbell
+6  A: 

Alternate solution to the one given by Brian Campbell would be to configure remote to push all refs, or push all branches and tags:

[remote "repository"]
        url = [email protected]:user/repo.git
        push  = +refs/heads/*:refs/heads/*
        push  = +refs/tags/*:refs/tags/*
Jakub Narębski