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.

  • Iterative database migration in with git/gerrit
  • Jenkins Gerrit trigger on all branches except master
  • How to fetch all changes with given topic from gerrit
  • How can I identify “unused” repositories in Gerrit?
  • How to install and use gerrit with eclipse?
  • Gerrit event on Jenkins doesn't trigger automatically on git push

  • 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.

  • dvcs partial merge (git, hg merge tracking)
  • Increase git hunk granularity
  • Using git with Doxygen FILE_VERSION_FILTER
  • How to recreate a branch from pull request?
  • git alias with bash conditional logic comparing strings - syntax issues
  • Git push to GitHub failing - seems to be trying to use HTTP?
  • 2 Solutions collect form web for “Getting GitHub and Gerrit to play nicely”

    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.

    Git Baby is a git and github fan, let's start git clone.