无法在 Git 中推送标签
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16465275/
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
Cannot push tags in Git
提问by user265950
I am unable to push the annotated tag in my git remote repository. All the access permission have been provided in gerrit. eg. [refs/*]
我无法在我的 git 远程存储库中推送带注释的标签。所有访问权限都在gerrit中提供。例如。[参考/*]
I am creating the tag using the below command
我正在使用以下命令创建标签
git tag -a v1.0 -m 'Base Version' 712d77e
When i try to push using the below commands
当我尝试使用以下命令推送时
git push origin v1.0
or
或者
git push origin --tags
I get the following error.
我收到以下错误。
Counting objects: 1, done.
Writing objects: 100% (1/1), 157 bytes, done.
Total 1 (delta 0), reused 0 (delta 0)
remote: Processing changes: refs: 1, done
To ssh://...
! [remote rejected] v1.0 -> v1.0 (prohibited by Gerrit)
error: failed to push some refs to 'ssh://...'
Please let me know how I should be able to push tags in repository.
请让我知道我应该如何在存储库中推送标签。
Thanks....
谢谢....
回答by ahmad molaie
This is a general error message that is returned by Gerrit if a push is not allowed, e.g. because the pushing user has no sufficient privileges.
这是一般错误消息,如果不允许推送,例如因为推送用户没有足够的权限,则 Gerrit 会返回该错误消息。
In particular this error occurs:
特别是发生此错误:
If you push a commit for code review to a branch for which you don't have upload permissions (access right Push on
refs/for/refs/heads/*
)if you bypass code review without Push access right on
refs/heads/*
if you push an annotated tag without Push Annotated Tag access right on
refs/tags/*
if you push a signed tag without Push Signed Tag access right on
refs/tags/*
if you push a lightweight tag without the access right Create Reference for the reference name
refs/tags/*
if you push a tag with somebody else as tagger and you don't have the Forge Committer access right for the reference name
refs/tags/*
if you push to a project that is in state Read Only
如果您将代码提交推送到您没有上传权限的分支(访问权限 Push on
refs/for/refs/heads/*
)如果你绕过代码而没有推送访问权限
refs/heads/*
如果您推送带注释的标签而没有“推送注释标签”访问权限
refs/tags/*
如果您在没有推送签名标签访问权限的情况下推送签名标签
refs/tags/*
如果你推送一个没有访问权限的轻量级标签为引用名称创建引用
refs/tags/*
如果您使用其他人作为标记者推送标记,并且您没有引用名称的 Forge Committer 访问权限
refs/tags/*
如果您推送到处于只读状态的项目
For new users it often happens that they accidentally try to bypass code review. The push then fails with the error message prohibited by Gerrit because the project didn't allow to bypass code review. Bypassing the code review is done by pushing directly to refs/heads/*
(e.g. refs/heads/master
) instead of pushing to refs/for/*
(e.g. refs/for/master
).
对于新用户来说,他们经常会意外地尝试绕过代码。然后推送失败,并显示 Gerrit 禁止的错误消息,因为该项目不允许绕过代码。绕过代码是通过直接推送到refs/heads/*
(例如refs/heads/master
)而不是推送到refs/for/*
(例如refs/for/master
)来完成的。
copied from prohibited by Gerrit
从Gerrit 禁止复制
More description: I have same problem with new installation of gerrit 2.7, searched and found this stackoverflow question, but my case was number 5 of this description(light weight tags), so i added Create Reference permission for refs/tags/*, and problem solved.
更多描述:我在新安装 gerrit 2.7 时遇到了同样的问题,搜索并找到了这个 stackoverflow 问题,但我的案例是这个描述的第 5 号(轻量级标签),所以我为 refs/tags/* 添加了创建引用权限,并且问题解决了。
回答by Yann
You need to add the following project's permissions for [refs/tags/*]:
您需要为 [refs/tags/*] 添加以下项目的权限:
- Create Reference: to create a new tag.
- Forge Committer Identity: allow different tag uploader (you) to original tagger.
- Forge Author Identity: allows handling of commit belonging to other users.
- 创建参考:创建一个新标签。
- 伪造提交者身份:允许不同的标签上传者(你)到原始标签者。
- 伪造作者身份:允许处理属于其他用户的提交。
Refer to Gerrit access controlsfor details
有关详细信息,请参阅Gerrit 访问控制
回答by michas
This line gives you a hint:
这一行给你一个提示:
! [remote rejected] v1.0 -> v1.0 (prohibited by Gerrit)
Gerrit prohibited the push as your user is not in a group with the "Push Annotated Tag"right.
Gerrit 禁止推送,因为您的用户不在具有“推送注释标签”权限的组中。
回答by Hasan Shaik
Create annotated and Check gerrit. You must be in right group which is allowed to create annotated
创建注释并检查gerrit。您必须在允许创建注释的正确组中
If you create simple tags gerrit may reject that refs, but again it might depends on gerrit configuration.
如果您创建简单的标签,gerrit 可能会拒绝该引用,但同样可能取决于 gerrit 配置。
create annotated tag:
创建带注释的标签:
git tag -a -m "Some message"
push all your tags:
推送所有标签:
git push --tags
check tags are created in remote:
检查标签是在远程创建的:
git ls-remote --tags
回答by panayot_kulchev_bg
"prohibited by Gerrit" - means that has to allow rights.
“被 Gerrit 禁止” - 意味着必须允许权限。
First select your project and go to "Access". Then "Edit" and from drop-down "add permission" . Than has to add the three permissions on the picture with the arrows.
首先选择您的项目并转到“访问”。然后“编辑”并从下拉菜单中“添加权限”。比必须用箭头在图片上添加三个权限。
Than you can use in terminal:
比您可以在终端中使用:
git push origin --tags
!!! IMPORTANTNotice that rights are for refs/tags/*
!!!重要请注意,权限适用于refs/tags/*