Importing already existing git repo with multiple branches and tags into gerrit

走远了吗. 提交于 2019-12-06 07:44:53

问题


I'm trying to import an already existing git repository with multiple branches and tags into gerrit. I'm following the official guide at https://gerrit-review.googlesource.com/Documentation/install-quick.html#_already_existing_project.

However, when issuing the push command all the branches and tags, except "master" which I'm currently in, are "prohibited by Gerrit". The output is something like this:

user@host:~/my-project$ git push ssh://user@localhost:29418/demo-project *:*
[....]
* [new branch]      master -> master
! [remote rejected] origin/Branch1 -> origin/Branch1 (prohibited by Gerrit)
! [remote rejected] origin/Branch2 -> origin/Branch2 (prohibited by Gerrit)
[....]
! [remote rejected] Tag1 -> Tag1 (prohibited by Gerrit)
! [remote rejected] Tag2 -> Tag2 (prohibited by Gerrit)
[....]

I'm administrator so it shouldn't be an access rights issue.

Update: By using blahdiblah's script (https://stackoverflow.com/a/16095671/63661) I was successful with moving all the branches. To be able to transfer all the tags, I first had to give the group Administrators the "Create Reference" permission for *refs/tags/** using the gerrit web interface. After that i could push them using git push --tags.


回答1:


The minimal set of permissions to allow for refs/* in order to import an existing repository to Gerrit was for us:

  • Create Reference (quite obviously)
  • Forge Author Identity and Forge Committer Identity (because you are pushing other people's commits)
  • Push (quite obviously)
  • Push Merge Commit (this is not included in Push, and you'll likely have merge commits)
  • Push Annotated Tag (we use annotations in some tags)

You also need to allow Push Signed Tag if you have signed tags, obviously.

Finally, if you plan to run the import more than once to incrementally sync repositories during some transition period, you also need to allow Read and enable Force Push for all Push permissions.



来源:https://stackoverflow.com/questions/19514459/importing-already-existing-git-repo-with-multiple-branches-and-tags-into-gerrit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!