tags:

views:

146

answers:

3

Since I created my repository it appears that the tags I have been creating are not pushed to the repository. When I do git tag on the local directory all the tags are present, but when I logon to the remote repository and do a git tag, only the first few show up.

What could the problem be?

+3  A: 

git push --tags

eevar
+3  A: 

By default, tag objects (i.e. signed or annotated tags) attached to commits new to the remote being pushed to are pushed.

Lightweight tags and tags attached to commits already on the remote aren't pushed.

You can use git push --tags or push tags individually by name for a different behaviour.

Charles Bailey
Your first paragraph does not seem to apply on my setup, but is there a way to add a tag during the commit itself, rather than use the git tag command later?
vfclists
@vfclists: Oops, my answer is all wrong. I was thinking fetch. Can you "unaccept" my answer so I can delete it?
Charles Bailey
How do I "unaccept" an answer? Is it by repeatedly clicking the up arrow above the number till it turns to zero?
vfclists
It's the green tick. I think you can just click once to undo.
Charles Bailey
+6  A: 

In default git remote configuration you have to push tags explicitely (while they are fetched automatically together with commits they point to). You need to use

$ git push <remote> tag <tagname>

to push a single tag, or

$ git push <remote> --tags

to push all tags.

This is very much intended behaviour, to make pushing tags explicit. Pushing tags should be usually conscious choice.


Alternatively you can configure the remote you push to to always push all tags, e.g. put something like that in your .git/config:

[remote "publish"] # or whatever it is named
    url = ...
    push = +refs/heads/*:refs/heads/*
    push = +refs/tags/*:refs/tags/*

This means force push all heads (all branches) and all tags (if you don't want force pushing of heads, remove '+' prefix from refspec).

Jakub Narębski
Doesn't this always do a 'force push' of all heads ?
Stefan Näwe
@Stefan: Yes it does. Updated.
Jakub Narębski