Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
516 views
in Technique[技术] by (71.8m points)

git - 如何使用Git将标签推送到远程存储库?(How do you push a tag to a remote repository using Git?)

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

(我已经将一个远程Git存储库克隆到了我的笔记本电脑,然后我想添加一个标签,所以我跑了)

git tag mytag master

When I run git tag on my laptop the tag mytag is shown.

(当我在笔记本电脑上运行git tag ,会显示标签mytag 。)

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:

(然后我想将它推送到远程存储库,所以我在所有客户端都有这个标签,所以我运行git push但是我收到了消息:)

Everything up-to-date

(一切都是最新的)

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

(如果我去我的桌面并运行git pull然后git tag没有显示标签。)

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.

(之后,我可以将更改从服务器拉到台式计算机,但在台式计算机上运行git tag时仍然没有标签。)

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

(如何将我的标签推送到远程存储库,以便所有客户端计算机都可以看到它?)

  ask by Jonas translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

To push a single tag:

(要推送单个标签:)

git push origin <tag_name>

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

(并且以下命令应该推送所有标签( 不推荐 ):)

git push --tags

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...