Adding a GitHub project to GerritHub

If you have a GitHub project and want people to be able to contribute to your project by adding code and reviewing patches you can add it to GerritHub.

Gerrit is a free, web-based team code collaboration tool. Software developers in a team can review each other’s modifications on their source code using a Web browser and approve or reject those changes. It integrates closely with Git, a distributed version control system. (From Wikipedia).

Adding your Project to GerritHub

  1. Go to GerritHub
  2. If you haven’t registered yet - Click on ‘First Time Sign In’ button on the upper right corner.
  3. Click on the ‘Sign In’ Button on the upper right corner.
  4. Enter your GitHub credentials (Unless you are already logged in to GitHub)   You’ll see the Dashboard: dashboard
  5. Click on the bold GitHub at the top of the dashboard and then on ‘Repositories’.
  6. Mark the repository you want to import and click ‘Import’ -> Next -> Next

Adding a SSH key

Before you can push your changes to Gerrit you need to add your SSH key:

  1. Click on your username (upper right corner)  -> Settings
  2. On the next page choose SSH Public Keys . Then add your ssh public key. ssh_keys

Submitting a change to your project

  1. Go back to your Dashboard and click on Projects and search your project i.e. username/project-name
  2. Click the Project and you’ll see details about the project.
  3. Install git and git-review For Fedora run:
     $ sudo dnf -y install git git-review
    
  4. Copy the line starts with ‘git clone’ and run.
     $ git clone ssh://@review.gerrithub.io:29418//
    
  5. Change directory to your project
     $ cd
    
  6. Add Gerrithub as a remote named gerrit
     $ git remote add gerrit \
       ssh://@review.gerrithub.io:29418//
    
  7. Set the gerrit remote
     git remote -s
    
  8. Make your changes and commit 9. Show the latest commit and make sure you see a line with Change-Id
     $ git log -1
        
     commit 91666e02ac48f0922b48c180bf6a7eca082a940e
     Author: user <user@example.com>
     Date: Thu Oct 13 00:00:08 2016 +0000
        
     test
        
     Change-Id: I104eccd92cfda7da4744f0877f10ff15ff1ae16a
    
  9. Submit your change to GerritHub
    $ git review
    
  10. Go to the GerriHub Dashboard and click on My->Changes. You should see your patch Under the ‘Outgoing reviews’ after_change

Reviewing a Patch

For testing purpose you can approve the patch and see it merged in GitHub

  1. Click on the patch
  2. Click on ‘Reply..’
  3. If you want to approve the patch you can choose ‘+2’ and in the Code-review  line and ‘+1’ at the Verified  line. You should now see a submit Button submit.PNG
  4. Click on the Submit button
  5. Go to your Github project and you should see your latest commit.

Adding reviewers

I found a great explanation here:https://github.com/midonet/midonet/wiki/Gerrit-Access-Rights-Policies

Tags: ,

Updated:

Leave a Comment