格里特推不起作用。远程被拒绝,被gerrit禁止

时间:2015-07-02 22:48:24

标签: git github ssh gerrit

我正在尝试将现有的回购添加到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'

我已经访问了gerrit网站,并在project/access下为所有用户添加了refs/head/*创建参考权限。

3 个答案:

答案 0 :(得分:9)

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:

  • refs/heads/*
    • create reference
    • forge author identity
    • forge committer identity
    • push
    • push merge commit
    • push annotated tag
  • refs/tags/*
    • create reference

答案 1 :(得分:2)

除了添加“创建引用”权限之外,您还需要确保具有直接推送/强制推送权限 - 创建引用将涉及创建新分支,而更新现有分支(即{{ 1}}和origin/HEAD)将需要直接推送/强制推送权限(我已经看到gerrit在文档中将其称为直接推送和强制推送)。

答案 2 :(得分:0)

在您的git项目中,使用git config --list查看您的user.name,user.email是否等于您当地的gerrit网站用户的姓名或电子邮件。它们必须相同。如果不相等,使用git config user.name XXX。

最后。 git config remote.origin.push refs / heads / :refs / for / 所以你可以使用git push origin master