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 http://code.google.com/p/gerrit/.
Using Gerrit hosted at https://git.eclipse.org/r
Enabling Gerrit for your Eclipse.org 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.
- 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 Eclipse.org 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
- 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 "firstname.lastname@example.org"
- Execute SSH once to accept the host key (or copy it from the registration web page)
ssh -p 29418 email@example.com
Doing Code Reviews with Gerrit
- Visit the Eclipse Gerrit Code Review instance to start reviewing.
- Use Gerrit queries to filter the review list for changes you are interested in.
- Register to watch projects if you want to be notified by email on new or updated changes pushed for review.
- Adjust your Gerrit preferences to customize it to your needs.
- See the Gerrit user guide for more information about using Gerrit.
- The EGit tutorial walks you through the basic steps of working with Gerrit and EGit.
Using Gerrit with the git command line:
- Upload your patch from Git to the target project:
git push ssh://firstname.lastname@example.org:29418/(project).git 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 remote.review.url ssh://email@example.com:29418/(project).git git config remote.review.push 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
- 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.
- Visit our Gerrit Code Review instance to start reviewing