git Gerrit 推送不起作用。远程拒绝,gerrit 禁止
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31195878/
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
Gerrit push not working. Remote rejected, prohibited by gerrit
提问by Vis
I am trying to add an existing repo to gerrit. I create an empty project and have tried pushing it (git push ssh://admin@localhost:29418/project *:*
). I get this error message in return:
我正在尝试将现有的 repo 添加到 gerrit。我创建了一个空项目并尝试推送它 ( git push ssh://admin@localhost:29418/project *:*
)。我收到此错误消息作为回报:
Counting objects: 14, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 384 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 3 (delta 1)
remote: Resolving deltas: 100% (1/1)
remote: Processing changes: refs: 3, done
To ssh://admin@localhost:29418/project
! [remote rejected] origin/HEAD -> origin/HEAD (prohibited by Gerrit)
! [remote rejected] origin/master -> origin/master (prohibited by Gerrit)
! [remote rejected] origin/ref/for/master/testing -> origin/ref/for/master/testing (prohibited by Gerrit)
error: failed to push some refs to 'ssh://admin@localhost:29418/project'
I have already gone to the gerrit site and under project/access
added refs/head/*
Create Reference privileges for all users.
我已经访问了 gerrit 站点,并为所有用户project/access
添加了refs/head/*
创建参考权限。
回答by volker
From my experience you need the following group permissions to import an entire repository to gerrit -- basically permissions to push everything to the gerrit repo:
根据我的经验,您需要以下组权限才能将整个存储库导入 gerrit —— 基本上是将所有内容推送到 gerrit 存储库的权限:
- refs/heads/*
- create reference
- forge author identity
- forge committer identity
- push
- push merge commit
- push annotated tag
- refs/tags/*
- create reference
- 参考/负责人/*
- 创建参考
- 伪造作者身份
- 伪造提交者身份
- 推
- 推送合并提交
- 推送注释标签
- 参考/标签/*
- 创建参考
回答by forkrul
In addition to adding the Create Reference privilege, you will also need to ensure that you have the direct push/force push privilege--creating a reference would involve creating a new branch, whereas updating an existing branch (namely, origin/HEAD
and origin/master
) will require the direct push/force push privilege (I have seen gerrit refer to this as both direct push and force push in the documentation).
除了添加创建引用权限之外,您还需要确保您具有直接推送/强制推送权限——创建引用将涉及创建一个新分支,而更新现有分支(即,origin/HEAD
和origin/master
)将需要直接推送/强制推送权限(我在文档中看到 gerrit 将其称为直接推送和强制推送)。
回答by u6222677
in your git project ,use git config --list to see your user.name,user.email is or not equal to your local gerrit site user's name or email.They must be same.if not equal, use git config user.name XXX.
在您的 git 项目中,使用 git config --list 查看您的 user.name,user.email 是否等于您本地 gerrit 站点的用户名或电子邮件。它们必须相同。如果不相等,请使用 git config user.name XXX。
at last. git config remote.origin.push refs/heads/:refs/for/so you can use git push origin master
最后。git config remote.origin.push refs/heads/ :refs/for/这样你就可以使用 git push origin master