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

查看:593
本文介绍了“因为标签已经存在,所以拒绝更新".尝试推入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中常见的原因是,默认情况下 Push all tags (将所有标签)设置为 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天全站免登陆