Gerrit Tutorial



SSH stands for Secure Shell or sometimes Secure Socket Shell protocol used for accessing network services securely from a remote computer. You can set the SSH keys to provide a reliable connection between the computer and Gerrit. You can check the existing SSH key on your local computer using the following command in Git Bash −. Chapter 1: Getting started with gerrit Remarks This section provides an overview of what gerrit is, and why a developer might want to use it. It should also mention any large subjects within gerrit, and link out to the related topics. Since the Documentation for gerrit is new, you may need to create initial versions of those related topics.

  • Gerrit Tutorial
  • Setting up Git
  • Set Up SSH Keys in Gerrit
  • Prepare to work with Gerrit
  • How to Submit a Patch

Gerrit Setup Tutorial

  • How Code is reviewed in Gerrit
  • Gerrit Useful Resources
  • Selected Reading

Gerrit is a web-based code review tool, which is integrated with Git and built on top of Git version control system (helps developers to work together and maintain the history of their work). It allows merging changes to Git repository when you are done with the code reviews.

This tutorial will help beginners learn the basic functionality of Gerrit tool. After completing this tutorial, you will find yourself at a moderate level of expertise in using Gerrit tool from where you can take yourself to the next levels.

We assume that you are going to use Gerrit to handle all levels of Java and Non-Java projects. Hence, it will be good if you have some amount of exposure to software development life cycle and a working knowledge of developing web-based and non-webbased applications.

Skip to end of metadataGo to start of metadataGerrit

For a tutorial of using Gerrit, this external wiki page is very helpful: https://www.mediawiki.org/wiki/Gerrit/Tutorial.

Here we try to gather frequently asked questions about Gerrit access and provide information on how to debug and resolve. If your question is not listed, please add to the end of this page.

This is usually a network access issue. Make sure the local network admin has opened access:

  1. the hostname gerrit.o-ran-sc.org is resolvable;
  2. gerrit.o-ran-sc.org is ping-able;
  3. ports needed by git clone are open.
    1. Git clone can be done in three different ways: http, https, or ssh. Their ports are 80, 443, and 29418 respectively.

With Gerrit review workflow, master branch is not directly accessible. Code change is pushed onto a temp reference branch, and merged onto master branch by Gerrit server when a repo committer accepts the change.

Everybody can clone then create local branch on his/her dev machine. But not all can push new branch to gerrit. Only committers of a repo can create branches.

Gerrit Code Review Tutorial

Gerrit Tutorial

Thus the Pull Request workflow of git is not used here. See the external wiki page referenced above for a tutorial on how to submit code changes.

This problem may occur due to a number of reasons. Because this step involves ssh connection to gerrit.o-ran-sc.org on a specific port for verifying ssh-key handshake, the following steps can help narrow down the issue.

  1. Local firewall may block such outgoing traffic.
    1. Run : nc gerrit.o-ran-sc.org 29418
    2. We should see something similar to: “SSH-2.0-GerritCodeReview_2.16.8 (SSHD-CORE-2.0.0)”. If not, most likely your local firewall is blocking outgoing traffic on port 29418. This can either be resolved by working with local IT networking staff, or switch to a different access.
  2. If step 1 test passes, the next is to verify that ssh is working:
    1. ssh -p 29418 {{ your Linux Foundation ID }}@gerrit.o-ran-sc.org gerrit version
    2. This command basically ssh into the gerrit server and run a simple version check command. We should see something like: gerrit version 2.16.8. If not, our ssh client is not configured correctly. Most likely the ssh key is not configured properly. We can now follow ssh debug process to figure what the problem is. Fir example, running option '-vvv' with the ssh command.
  3. Because the O-RAN SC project requires all contributors to sign contribution agreement, 'git review -s' will not work if the contributor has not done so. This can be verified by running: git push --dry-run ssh://{{ your Linux Foundation ID }}@gerrit.o-ran-sc.org:29418/it/dep --all. . If the CLAs have been signed, the expected response is: 'Everything up-to-date'. Otherwise, please proceed to sign the CLAs by following this tutorial: Signing Contributor License Agreement.
  4. If all previous steps work, the next suspect is local Gerrit/git configuration.