简体   繁体   English

将Git中的项目移至Gerrit

[英]Move projects in Git to Gerrit

I have some projects in My Git Repository. 我的Git存储库中有一些项目。 I would like to move all that to Gerrit. 我想将所有内容移至Gerrit。 I am not mentioning about importing projects one by one from git and pushing it to Gerrit as it might take a lot of time as the number of projects in Git is large. 我没有提到要从git逐个导入项目并将其推送到Gerrit,因为Git中的项目数量很大,可能要花费很多时间。 Or in other words I can say like I would like to convert the local git repository to the git repo of my Gerrit so that I can get all the existing projects in local Git in Gerrit. 换句话说,我可以说想将本地git存储库转换为Gerrit的git repo,以便可以在Gerrit的本地Git中获取所有现有项目。 For this I gave the Location of Git repositories during gerrit initialization as my local Git Repository and tried but I didnt get the result which I was looking for. 为此,我在Gerrit初始化期间将Git信息库的位置作为本地Git信息库进行了尝试,但没有得到想要的结果。 Though All-Projects.git came there, in the Gerrit UI other projects in the local Git repositories were not listed. 尽管All-Projects.git到了那里,但在Gerrit UI中未列出本地Git存储库中的其他项目。 Is there anyway to do this? 反正有这样做吗? It would be greatly helpful if someone could help me to solve this. 如果有人可以帮助我解决这个问题,将大有帮助。 Thank you 谢谢

Multiple ways to move existing repositorys to gerrit. 将现有存储库移至gerrit的多种方法。 Don't forget, always create a new project with this repository. 别忘了,总是使用此存储库创建一个新项目。 Mandatory. 强制性。 You can automate it via their API. 您可以通过他们的API将其自动化。 It's not difficult to create a project via API. 通过API创建项目并不难。

Options you have then: 然后,您可以选择:

  1. copy the old .git folder to the place of the newly from gerrit created one. 将旧的.git文件夹复制到gerrit创建的文件夹中。 What basically asked for. 基本要求什么。
  2. import the old git repository into gerrit while not having direct access to the file system. 在不直接访问文件系统的情况下,将旧的git存储库导入gerrit。 \\# In an existing repository git remote rm origin git remote add origin ssh://your-gerrit-instance:29418/folder/repository git push --tags origin git push --all origin

I know that the 2nd one is not what you ask for, but if you have a dozen of git repositories and automate it anyway, that would be an option, too. 我知道第二个不是您想要的,但是如果您有十二个git存储库并且无论如何都要对其进行自动化,那也将是一个选择。

I would also suggest to reindex in the end. 我也建议最后重新索引。 I am not 100% sure if it is needed in this case. 我不确定在这种情况下是否需要它。

sudo /etc/init.d/gerrit stop
java -jar /var/gerrit/review/bin/gerrit.war reindex -d /var/gerrit/review
sudo /etc/init.d/gerrit start

You can copy the *.git Directory of the git repository to the directory where gerrit deposits the git repos. 您可以将git仓库的* .git目录复制到gerrit存放git仓库的目录中。 After restart of gerrit should process the new project and add it to the list of new projects and you can edit description and access rights. 重新启动gerrit之后,应处理新项目并将其添加到新项目列表中,并且您可以编辑描述和访问权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM