我向计算机上的主分支添加了一个标记:

git tag mytag master

如何将其推送到远程存储库?运行git push会显示以下消息:

一切都是最新的

但是,远程存储库不包含我的标记。


当前回答

标记不会通过git push命令发送到远程存储库。我们需要使用以下命令将这些标记显式发送到远程服务器:

git push origin <tagname>

我们可以使用以下命令一次推送所有标签:

git push origin --tags

以下是有关git标记的完整详细信息的一些资源:

http://www.cubearticle.com/articles/more/git/git-tag

http://wptheming.com/2011/04/add-remove-github-tags

其他回答

将标签推送到远程

git push origin mytag

从远程获取所有标记

git fetch --all --tags

我使用git push<remote name>tag<tag name>来确保我正在推送一个标签。我使用它像:git push origin tag v1.0.1。此模式基于文档(man git push):

OPTIONS
   ...
   <refspec>...
       ...
       tag <tag> means the same as refs/tags/<tag>:refs/tags/<tag>.

您可以通过简单的gitpush--tags命令推送所有本地标记。

$ git tag                         # see tag lists
$ git push origin <tag-name>      # push a single tag
$ git push --tags                 # push all local tags 

我做了这样的事情:

git push --tags origin <branch-name> <tag-name>

e.g. : git push --tags origin master v2.0

标记不会通过git push命令发送到远程存储库。我们需要使用以下命令将这些标记显式发送到远程服务器:

git push origin <tagname>

我们可以使用以下命令一次推送所有标签:

git push origin --tags

以下是有关git标记的完整详细信息的一些资源:

http://www.cubearticle.com/articles/more/git/git-tag

http://wptheming.com/2011/04/add-remove-github-tags