GIT返回致命错误:“[tag]已存在” 当删除然后重新创建标签时

huangapple go评论60阅读模式
英文:

GIT returning fatal "[tag] already exists" error when Deleting then Recreating Tags

问题

在GIT中,我正在尝试执行一系列的GIT命令来删除一个已存在的标签,然后重新创建它。然而,它返回一个“致命错误:标签'2.0.1'已经存在”的错误。有没有人知道我做错了什么,或者可能漏掉了哪个命令?

我正在执行以下一系列的命令:

git clone git@git.someaddress.com/test_project project_dir
cd project_dir
git push --delete origin 2.0.1
git tag 2.0.1 -m "重新创建标签"

目前为了解决这个问题,在执行push --delete命令之后,我删除了project_dir,然后重新克隆存储库以创建标签,这并不是非常高效的方法。

英文:

In GIT, I am trying to execute a series of GIT commands to delete an existing tag then recreate it. However, it is returning a "fatal: tag '2.0.1' already exists" error. Anyone have any idea what I'm doing wrong or what command I'm possibly missing?

I am executing the following sequence of commands:

git clone git@git.someaddress.com/test_project project_dir
cd project_dir
git push --delete origin 2.0.1
git tag 2.0.1 -m "Recreated tag"

Currently to work around this, after I execute the push --delete command, I'm deleting project_dir and recloning the repo to create the tag, which isn't very efficient.

答案1

得分: 2

你还需要删除本地副本的标签:

git tag -d 2.0.1

从远程删除不会删除本地仓库中的标签。

英文:

You also have to delete your local copy of the tag:

git tag -d 2.0.1

Deleting it from the remote does not delete it from your local repository.

huangapple
  • 本文由 发表于 2023年6月9日 05:48:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76435907.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定