开发者

Getting GitHub and Gerrit to play nicely

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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜