当标签已经存在于遥控器上时,Git强制推送标签 [英] Git force push tag when the tag already exists on remote

查看:74
本文介绍了当标签已经存在于遥控器上时,Git强制推送标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个已经推到遥控器上的标签.当另一个用户创建相同的标签并尝试推送时,推送将失败,因为该标签已存在于遥控器上.

I have a tag already pushed onto the remote. When another user creates the same tag and tries to push, the push will fail because the tag already exists on the remote.

但是我认为如果我做了--f force tag push,它应该可以工作.但这不是我所看到的.

But I thought if I did --f force tag push, it should work. But that is not what I see.

我认为我必须这样做.

 Create tag
 Push tag -> If push fails -> Delete tag on remote
                           -> push tag again.

这是正确的吗?

我在使用带注释的标签

 git -a v1.0 -f -m "message"

推荐答案

在我的情况下,当标签已经存在时,遥控器拒绝强制推入.

In my case, remote was rejecting an force push when the tag already exists.

所以,当推送被拒绝时,我做了

So, when the push was rejected, I did

git push --delete origin tagname 

并推送了新标签.

请参阅Torek对我的问题的评论.在某些情况下,遥控器也可以拒绝删除.

Please see Torek's comment to my question. There is a case when remote can reject the delete too.

这篇关于当标签已经存在于遥控器上时,Git强制推送标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆