Getting GitHub and Gerrit to play nicely

匿名 (未验证) 提交于 2019-12-03 02:52:02

问题:

I host a private repo on GitHub. I also want to use Gerrit, particularly for the Hudson Gerrit Trigger plugin. AFAICT, there isn't any simple solution for using them together.

I'd appreciate any help on any of the following wants.


What I want

  • Clone GitHub repo and add to Gerrit's projects either:
    1. manually, or
    2. during init
  • Merge changes with GitHub using Gerrit

What I've tried

Cloning/Adding...

Manually: I clone the repo as normal, then add into H2 like so:

INSERT INTO projects (use_contributor_agreements,submit_type,name) VALUES ('N','M','new/Repo'); 

During init:

*** Git Repositories ***  Location of Git repositories   [git]: git@github.com:YourName/Repo.git 

I don't think that's correct.


What happens

Cloning/Adding...

Manually:

I get this error: repository not found: Cannot open repository Repo

During init:

Creates the directory at ~/gerrit2/git@github.com:YourName/Repo.git and sub-directory Repo.git, which itself contains an empty Git repo. Not exactly what I wanted.

回答1:

Not try myself, but you could use gerrit repo and mirror to github



回答2:

Gerrit is built on top of JGit which does not support a remote GitHub repository.

JGit itself allows to either have the repository on your local (or shared) filesystem or to have it accessible through a genefic "DFS" (Distributed File System) provider. See as reference: JGit : connect to distant repository.

I wrote an article on a different strategy to use Gerrit and GitHub together: http://www.packtpub.com/article/using-gerrit-with-github

In a nutshell you can delegate three different tasks to GitHub:

  1. Authentication: Gerrit request a GitHub login using OAuth 2.0 authentication API
  2. Pull requests: Gerrit can fetch GitHub pull requests and present them as Gerrit changes
  3. Replication: Gerrit can push back the changes (either in review or merged) to GitHub

NOTE: Once you start using Gerrit as your gateway to GitHub, you SHOULD NOT push directly to GitHub anymore but rely on either Pull Requests (imported to Gerrit) or directly pushing to Gerrit and working through changes review.

If you want to experiment Gerrit and GitHub integrated in this way, you can check out http://gerrithub.io, which is essentially a Gerrit 2.9-SNAPSHOT with the GitHub plugin configured as before.

Luca.



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