Skip to main content
Jump to: navigation, search


Revision as of 19:10, 1 February 2012 by (Talk | contribs) (Doing Code Reviews with Gerrit)

From TFM: Gerrit is a web based code review system, facilitating online code reviews for projects using the Git version control system. It is not available for CVS or SVN. For more information about Gerrit, please see

Using Gerrit hosted at

Enabling Gerrit for your Project

  • File a bug and specify for which project you'd like to enable Gerrit
  • Ask your Project Lead to +1 the request
  • Choose one of the two options:
    • I want project committers use Gerrit code review exclusively for my project. Everything must be reviewed -- no direct access to the main repo should be available.
    • I want project committers to be able to bypass the Gerrit code review system and push changes directly to the git repo.

User Account

  • In order to contribute you need an Eclipse user account . If you are an Eclipse committer you already have one.
  • Confirm you agree to the Terms of Service by completing the Individual Contributor agreement.


Gerrit Web UI
Logon to the Gerrit Web UI using the email address you registered with your Eclipse (and Bugzilla) account and your Eclipse password.
Git over SSH
When accessing Gerrit over SSH from git or EGit use the username displayed here and upload your public SSH key to Gerrit here
Git over HTTPS
When accessing Gerrit over HTTPS from git or EGit use username and HTTP password displayed here

SSH Key Pair

  • Add one or more public SSH keys to Gerrit here.
  • If you are absolutely certain you do not have keys already, you must create a public and private pair of SSH keys. It is strongly recommended that you use a passphrase.
  • Generating SSH key pair on command line
ssh-keygen -t rsa -C ""
  • Execute SSH once to accept the host key (or copy it from the registration web page)
ssh -p 29418

Doing Code Reviews with Gerrit

Using Gerrit with the git command line:

  • Upload your patch from Git to the target project:
git push ssh:// HEAD:refs/for/master

Adding a dedicated remote

Since git can have multiple remotes, you can define one to be used to refer to Gerrit to save typing. Inside a previously checked-out repository you can run:

cd path/to/project
git config ssh://
git config HEAD:refs/for/master

You can now submit review requests from either repository using:

git push review

Using Gerrit with EGit:

Eclipse will look for your private key in the SSH2 Home location specified in the General>Network Connections>SSH2 Preference Page. If your id_rsa private key makes use of the AES-128-CBC algorithm (view the file as text to confirm), Eclipse will need at least com.jcraft.jsch 0.1.44 to make use of it.

  • Clone the repository and use the last page of the Clone Wizard to configure pushing to the code review queue.
  • Alternative approach adding a review remote in the Git Repositories view:
    • From the appropriate Remotes node, create a New Remote and choose to Configure for Push. A unique name should be chosen, review is suggested.
    • Change the main URI or Add a Push URI (your Gerrit user name must be used here)
    • In the Ref mapping section, add a RefSpec specification of HEAD:refs/for/master
    • Changes committed to your local clone can now be pushed to Gerrit using the review Remote. You will be prompted for your private key's passphrase if Eclipse is looking for it in the right place.

Back to the top