“更新被拒绝,因为标签已经存在"尝试推入 SourceTree 时 [英] "Updates were rejected because the tag already exists" when attempting to push in SourceTree

查看:77
本文介绍了“更新被拒绝,因为标签已经存在"尝试推入 SourceTree 时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试通过源树推送时,出现以下错误:

When attempting to Push via Source Tree, I get the following error:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags origin refs/heads/master:refs/heads/master 
Pushing to https://user@github.com/repo.git
To https://user@github.com/repo.git
 = [up to date]      master -> master
...
 ! [rejected]        example_tag -> example_tag (already exists)
updating local tracking ref 'refs/remotes/origin/master'
error: failed to push some refs to 'https://user@github.com/repo.git'
hint: Updates were rejected because the tag already exists in the remote.
Completed with errors, see above

据我所知,我没有对此标签进行任何更改.我该如何解决这个问题?

I didn't make any changes to this tag as far as I know. How can I fix this?

推荐答案

如果您没有对要保留的标签进行任何本地更改,那么您可以删除因为它而被拒绝的标签已经存在(在本例中为example_tag):

If you have not made any local changes to the tag that you want to keep, then you can remove tag that was rejected because it already exists (example_tag in this case):

  1. 右键点击标签并选择删除它(一定要取消选中从所有遥控器中删除标签复选框).
  2. 选择提取选项(提取并在本地存储所有标签不必必须启用).
  3. 您现在应该拥有刚刚删除的标签,并且尝试推送将不再显示该错误消息.
  1. Right-click the tag and choose to delete it (be sure to uncheck the Remove tag from all remotes checkbox).
  2. Choose the Fetch option (Fetch and store all tags locally does not have to be enabled).
  3. You should now have that tag that was just deleted back, and attempting to Push will no longer show that error message.

这在 SourceTree 中很常见的原因是因为 推送所有标签 选项默认设置为 on.(另一种隐藏此错误的方法是取消选中该选项.)

The reason this is common in SourceTree is because the Push all tags option is set to on by default. (Another way to hide this error is to uncheck that option.)

这篇关于“更新被拒绝,因为标签已经存在"尝试推入 SourceTree 时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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