将已有的git repo与多个分支和标签导入gerrit [英] Importing already existing git repo with multiple branches and tags into gerrit

查看:723
本文介绍了将已有的git repo与多个分支和标签导入gerrit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将一个已经存在的带有多个分支和标签的git仓库导入gerrit。我遵循 https:// gerrit-review官方指南。然而,当发出push命令时,所有的分支和标签,除了主我目前所在的Gerrit禁止。输出是这样的:

pre $ user @ host:〜/ my-project $ git push ssh:// user @ localhost :29418 / demo-project *:*
[....]
* [新分支] master - >掌握
! [remote rejected] origin / Branch1 - > origin / Branch1(Gerrit禁止)
! [remote rejected] origin / Branch2 - > origin / Branch2(由Gerrit禁止)
[....]
! [远程拒绝] Tag1 - > Tag1(Gerrit禁止)
! [远程拒绝] Tag2 - > Tag2(由Gerrit禁止)
[....]

我是管理员它不应该是访问权限问题。



更新:
通过使用blahdiblah的脚本(
https://stackoverflow.com/a/16095671/63661 )我在移动所有分支方面取得了成功。
为了能够传输所有标签,我首先必须使用gerrit web界面为组管理员提供 / tags / **的 Reference Reference 权限。之后,我可以使用 git push --tags

解决方案

允许 refs / * 以将现有的存储库导入Gerrit对我们来说是:


  • 创建引用(很明显)
  • 伪造作者标识 Forge Committer Identity (因为您推送其他人的提交)

  • 推送(显然)

  • 推送合并提交(这不包括在推送
  • 推注释标记(我们在一些标记中使用注释)
  • >


如果您有签名标签,您还需要允许推送签名标签



最后,如果您计划在某个过渡期间不止一次运行导入来增量式同步存储库,则还需要允许读取并为所有推送权限启用强制推送 p>

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.

解决方案

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.

这篇关于将已有的git repo与多个分支和标签导入gerrit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆