git 如何删除 GitLab 存储库中的标签

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30858781/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:18:04  来源:igfitidea点击:

How do I remove Tag in GitLab repository

gittagsgitlab

提问by Shoji Urashita

I am using GitLab 7.7.2 and tried to remove Tag in a repository in GitLab. I could remove tag in a local repository but cannot remove tag in origin. How do I remove tag in GitLab repository?

我正在使用 GitLab 7.7.2 并尝试删除 GitLab 存储库中的标签。我可以删除本地存储库中的标签,但无法删除源中的标签。如何删除 GitLab 存储库中的标签?

$ git tag -d Tag_AAA
Deleted tag 'Tag_AAA' (was d10bff2)

$ git push --delete origin Tag_AAA
remote: GitLab: You don't have permission
To [email protected]:root/Repository.git
 ! [remote rejected] Tag_AAA (pre-receive hook declined)
error: failed to push some refs to '[email protected]:root/Repository.git'

采纳答案by VonC

Now (GitLab 12.1, July 2019), a developer can remove a (non-protected) tag (not just a maintainer or owner)

现在(GitLab 12.1,2019 年 7 月),开发人员可以删除(不受保护的)标签(不仅仅是维护者或所有者)

See "Developer role can rewrite/remove Git tags"

请参阅“开发人员角色可以重写/删除 Git 标签

Git tags are useful for referencing specific points and are typically used for tagging specific versioned releases.

To make git tags easier to use by development teams, we're adding the ability to allow Developers to rewrite and remove non-protected tags.
Protected tags still require Maintainer or Owner permissions.

Git 标签对于引用特定点很有用,通常用于标记特定版本的发布。

为了让开发团队更容易使用 git 标签,我们添加了允许开发人员重写和删除不受保护的标签的功能。
受保护的标签仍需要维护者或所有者权限。

The permission matrixhas been updated.
See issue 52954.

允许矩阵已更新。
请参阅问题 52954

回答by liushuaikobe

Obviously you don't have the permission of deleting tags in remote GitLab repo.

显然您没有删除远程 GitLab 存储库中标签的权限。

Either ask for the owner of the repo to grant you the permission of master or let him help you to delete the tag would help.

要么要求 repo 的所有者授予您 master 的许可,要么让他帮助您删除标签会有所帮助。

回答by Yakir GIladi Edry

# delete locally:
git tag -d <tag>

# delete remotely:
git push origin :refs/tags/<tag>

# another way to delete remotely:
git push --delete origin <tag>

回答by Achraf JEDAY

You need to have the maintainer or owner role to be able to rewrite/remove Git tags.

您需要拥有维护者或所有者角色才能重写/删除 Git 标签。

See GitLab permissions: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/permissions.md

查看 GitLab 权限:https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/permissions.md