Cannot delete a git tag in the remote

时间:2016-12-14 07:11:00

标签: git git-tag

I am trying to delete a tag in the remote. I get conflicting answers - "tag does not exist" and then "tag was deleted", but when I check, the tag is still there. There is a similar question here ( meaning of git push tag error: "Deleting a non-existent ref.")但在我的案例中没有帮助。 感谢

% git --version 
git version 2.11.0
% git ls-remote 2>/dev/null | grep amirk|grep '\.72$'
68a1595db91fca0cc1fa24566e9e7173fcd05c5e    refs/tags/Forked_branch_amirk/test-10.0.0.72
% git push origin :refs/tags/Forked_Branch_amirk/test-10.0.0.72 
remote: warning: Deleting a non-existent ref.
To <my-remote-git-repo>
- [deleted]               Forked_Branch_amirk/test-10.0.0.72
% git ls-remote 2>/dev/null | grep amirk|grep '\.72$'            
68a1595db91fca0cc1fa24566e9e7173fcd05c5e    refs/tags/Forked_branch_amirk/test-10.0.0.72

2 个答案:

答案 0 :(得分:2)

“删除不存在的引用”表示它不存在,但git ls-remote输出表明它 。此时有两个明显的选择:

  • 标签,但是巧妙地拼写不同于它出现的标签,例如,分支名称中包含一些不可见的字符,或者
  • pushls-remote不同的服务器,例如,您已定义了单独的提取和推送网址,或者您当前的分支有origin以外的远程设置

后者似乎更有可能。要检查,请运行git config --get branch.$(git symbolic-ref --short HEAD).remote,以确保当前分支的遥控器确实是origin;如果是,请运行git remote show origingit remote show -n origin

答案 1 :(得分:1)

目前还不清楚为什么标准语法(git push origin:refs / tags / tagname)在我的系统上不起作用。 但是这里有一个可行的替代语法:

git push --delete origin Forked_branch_amirk/test-10.0.0.36
相关问题