无法在 git 存储库中创建标签

Cannot create tag in git repository

我有一个本地 git 存储库,我在给定的分支 (release/0.5.0)

中工作
$ git status
# On branch release/0.5.0
nothing to commit (working directory clean)

最后一次提交 (HEAD) 是

$ git log -n 1
commit b24830d8e4df3d3d2553e0422c411fc00d30fe35
Author: foo <foo@bar.com>
Date:   Thu Feb 26 17:55:35 2015 +0100

    ADD Step: 0.4.1-next -> 0.5.0

我有一个名为 0.5.0 的标签(以及其他标签)

$ git tag
0.4.1/KO
0.5.0

指向我分支中的上述最后一次提交

$ git rev-list 0.5.0 | head -n 1
b24830d8e4df3d3d2553e0422c411fc00d30fe35

我想创建第二个标签,名称为 0.5.0/KO 指向同一个提交(我假设 git 让 N 个标签指向同一个提交没有问题) .但是,我得到一个错误:

$ git tag 0.5.0/KO
error: unable to resolve reference refs/tags/0.5.0/KO: Not a directory
fatal: refs/tags/0.5.0/KO: cannot lock the ref

也许这是由于新标签的名称星号与现有标签的名称(名为 0.5.0 的那个)加“/”有关?关于如何执行此操作的任何帮助?

refs/tags/0.5.0 已经存在,但它不是一个目录(它是一个文件),所以 Git 不能在文件树中在它下面创建任何东西,Git 也不能创建一个名为 refs/tags/0.5.0 的目录。您必须为新标签命名不包含 / 的名称(例如 0.5.0-KO)。