Time for action – setting up a Gerrit profile

Gerrit is a distributed version control system review tool that can be used to upload patches for review and ultimate merging with the repository. It provides a Git interface and acts as a remote Git server, so using it with existing tools or command lines is trivial.

  1. Navigate to the Gerrit user interface at https://git.eclipse.org/r/ and ensure that the profile is correctly set up. The name and e-mail address will be taken from the information provided when creating the Eclipse account.

    Note

    A password is required in order to push changes to Gerrit. This can be done either through a Gerrit-specific randomly generated HTTP password, or through an uploaded SSH key. Note that while the e-mail address and login details used to access Gerrit are the same as for Bugzilla, for pushing changes through Git a different password is used.

  2. An HTTP password can be generated by going to https://git.eclipse.org/r/#/settings/http-password and clicking on the Generate Password button. This shows the user name and the password to use for the HTTPS URLs, which will be of the form https://git.eclipse.org/r/#/q/status:open. This is the same as the one used to clone the repository initially, except replacing the gitroot for r in the URL.
  3. To use SSH, a private/public key is required. This can be generated by command-line tools, or through Eclipse itself. Navigate to the Preferences menu, and then under the General | Network Connections | SSH2 panel there is a Key Management tab which can be used to generate an SSH keypair. Clicking on the Generate RSA Key… or Generate DSA Key… buttons will result in a new public/private key being generated. The window shows the public part of the keypair (which can be pasted into Gerrit at https://git.eclipse.org/r/#/settings/ssh-keys). The private part is not shown, but the Save Private Key… allows the private key to be saved to a file, by default, ~/.ssh/id_rsa or ~/.ssh/id_dsa—but using a host-specific name such as ~/.ssh/id_rsa-gerrit may be sensible. The private key can then be selected on the command line, or through an entry in the ~/.ssh/config file:
    Host git.eclipse.org
    IdentityFile ~/.ssh/id_rsa-gerrit
    User myusername
  4. Verify that running ssh into Gerrit works as expected, using port 29418:
    $ ssh -p 29418 git.eclipse.org
    
      ****    Welcome to Gerrit Code Review    ****
    
      Hi My Name, you have successfully connected over SSH.
    
      Unfortunately, interactive shells are disabled.
      To clone a hosted Git repository, use:
    
      git clone ssh://[email protected]:29418/REPO_NAME.git
    
    Connection to git.eclipse.org closed.
    

    Note

    On Windows, the command-line tool plink can be used to perform ssh connections. This is part of the putty package which is available from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html. In order to use this from Eclipse or command line, set an environment variable GIT_SSH to point to the full path of the plink executable.

What just happened?

Setting up a Gerrit account is necessary in order to be able to push changes to the review system. The majority of development with Eclipse is done with Gerrit and being able to trigger builds and run tests automatically is a key advantage.

Gerrit can be authenticated using a randomly generated HTTP password, or through an SSH interface running on port 29418. These are separate from the Eclipse account information used to log into Bugzilla and other tools.

Using an SSH connection is generally easier on Linux and macOS servers, because the information can be stored securely in the keychain or through a key agent. It may be easier to use HTTP as a communication protocol on Windows, or when behind a firewall.

It's possible to test the connection to Gerrit using the command line and see if the Welcome message is displayed. This is worth doing to verify that it has been set up correctly before trying to push code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.200.66