git 禁止将 Gerrit 推送到 refs/for/master

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8483692/
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-10 12:28:58  来源:igfitidea点击:

Gerrit push to refs/for/master prohibited

gitpushgerrit

提问by coanor

I have updated the All Projectaccess permission yesterday, people says that they cannot push changes to repository this morning. After I recovered the access permission, they still cannot push changes to repository, only cloneworks fine. While push changes to remote repository, it says that:

我昨天更新了所有项目访问权限,人们说他们今天早上无法将更改推送到存储库。在我恢复访问权限后,他们仍然无法将更改推送到存储库,只能clone正常工作。在将更改推送到远程存储库时,它说:

![remote rejected] HEAD -> refs/for/master (prohibited by Gerrit)

All our other projects are inherit from All project's access permission, I updated the access permission to the lowest level (i.e. Anonymouscan push branch to refs/heads/*) for test, but I find that the Administratorcannot push changes to the repository too!

我们其他项目都是继承All项目的访问权限,我把访问权限更新到最低级别(即匿名可以推送分支到refs/heads/*)进行测试,但我发现管理员也无法推送更改到存储库!

Is there any other settings need to add?

是否还有其他设置需要添加?

回答by dunni

To push to the review branches (i. e. refs/for/*), you have to set the permission "Push" for the reference refs/for/refs/*. You then also need the permission Label Code Review, Label verifiedand Submitfor the reference refs/heads/*to do the actual code review.

要推送到评论分支(即refs/for/*),您必须为引用设置“推送”权限refs/for/refs/*。然后Label Code Review,您还需要权限,Label verified以及Submit进行refs/heads/*实际代码的参考。

If you don't want code review, but push directly to the branch, then your permissions are correct, but then you also have to push to refs/heads/master, and not refs/for/master.

如果你不想代码,而是直接推送到分支,那么你的权限是正确的,但是你也必须推送到refs/heads/master,而不是refs/for/master

回答by Venu Gopal Tewari

adding following line in Git config file worked for me:

在 Git 配置文件中添加以下行对我有用:

push=HEAD:refs/for/master

push=HEAD:refs/for/master