Skip to Content

[See the document Install Gerrit in Tomcat under Windows on how to install Gerrit.]

To effectively work with Gerrit, you use SSH. The need to enter a password is substituted by transmitting a key. This authentication method allows for background processing and automation. First step is to create a SSH key and make Gerrit aware of that key. Gerrit comes with a documentation explaining how to create and add the SSH key. To see this dialog, log on to Gerrit, open the settings page and select the SSH Public Keys option.

/wp-content/uploads/2013/06/confgerrit1_228997.jpg

To follow this documentation on Windows, it means to:

  1. Open git bash
  2. Run ssh-keygen
  3. Enter a passphrase
  4. Open the id_rsa.pub file in Notepad and copy/paste the key to Gerrit.

The first 3 steps generate a private and public key. The private key will stay on the user home directory, the public key will be added to Gerrit.

/wp-content/uploads/2013/06/confgerrit2_229025.jpg

The public key is id_rsa.pub. Open this file to see your public key.

/wp-content/uploads/2013/06/confgerrit3_229026.jpg

Copy the public key  into clipboard and paste it to Gerrit: open the SSH Public Keys page and add the public key generated above.

/wp-content/uploads/2013/06/confgerrit4_229027.jpg

As a result, your public key is added to Gerrit, allowing you to log on to Gerrit using SSH and not be prompted to enter a password.

/wp-content/uploads/2013/06/confgerrit5_229031.jpg

To test if Gerrit is accepting automatic logon via SSH, just connect to the Gerrit’s SSH server. By default, the SSH server is listening on port 29418. Open Git bash and issue the command

ssh –p 29418 <username>@localhost

If everythink works, the result should look like:

/wp-content/uploads/2013/06/confgerrit6_229032.jpg

Very likely possible error to receive

It is very likely that when running the above SSH command, that you won’t get automatically logged on, but instead see this message: Could not open a connection to your authentication agent.

This means that SSH is not able to use your private key. Follow the steps outlined at [1] to start the ssh-agent process.

exec ssh-agent bash
ssh-add path/to/.ssh/id_rsa

/wp-content/uploads/2013/06/confgerrti7_229034.jpg

Now add your identity by opening git bash and run

  1. ssh-add –l to see if your ssh-agent is running and accepting connections and
  2. ssh-add <path to your private key>

/wp-content/uploads/2013/06/confgerrit8_229033.jpg

Now ssh will be able to use your private key.

[1] http://imikay.wordpress.com/2011/08/06/ssh-add-could-not-open-a-connection-to-your-authentication-agent-on-windows/

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply