How do you push a tag to a remote repository using

2019-01-01 09:33发布

I have cloned a remote Git repository to my laptop, then I wanted to add a tag so I ran

git tag mytag master

When I run git tag on my laptop the tag mytag is shown. I then want to push this to the remote repository so I have this tag on all my clients, so I run git push but I got the message:

Everything up-to-date

And if I go to my desktop and run git pull and then git tag no tags are shown.

I have also tried to do a minor change on a file in the project, then push it to the server. After that I could pull the change from the server to my Desktop computer, but there's still no tag when running git tag on my desktop computer.

How can I push my tag to the remote repository so that all client computers can see it?

10条回答
冷夜・残月
2楼-- · 2019-01-01 10:08

If you are working in a branch:

git push --tags origin branch_name
查看更多
ら面具成の殇う
3楼-- · 2019-01-01 10:13

To push specific, one tag do following git push origin tag_name

查看更多
心情的温度
4楼-- · 2019-01-01 10:15

You can push your local tags by simply git push --tags command.

$ git tag                         # see tag lists
$ git push origin <tag-name>      # push a single tag
$ git push --tags                 # push all local tags 
查看更多
刘海飞了
5楼-- · 2019-01-01 10:17

To push a single tag:

git push origin <tag_name>

And the following command should push all tags (not recommended):

git push --tags
查看更多
登录 后发表回答