SlideShare a Scribd company logo
Gerrit tutorial
Gerrit
i
AbouttheTutorial
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.
Audience
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.
Prerequisites
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-web-
based applications.
Copyright&Disclaimer
 Copyright 2018 by Tutorials Point (I) Pvt. Ltd.
All the content and graphics published in this e-book are the property of Tutorials Point (I)
Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish
any contents or a part of contents of this e-book in any manner without written consent
of the publisher.
We strive to update the contents of our website and tutorials as timely and as precisely as
possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.
Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our
website or its contents including this tutorial. If you discover any errors on our website or
in this tutorial, please notify us at contact@tutorialspoint.com
Gerrit
ii
TableofContents
About the Tutorial ............................................................................................................................................i
Audience...........................................................................................................................................................i
Prerequisites.....................................................................................................................................................i
Copyright & Disclaimer.....................................................................................................................................i
Table of Contents ............................................................................................................................................ ii
1. Gerrit ─ Overview......................................................................................................................................1
SETTING UP GERRIT ....................................................................................................................4
2. Gerrit ─ Installation...................................................................................................................................5
Installation of Git Client...................................................................................................................................5
3. Gerrit ─ Configure Git................................................................................................................................6
4. Gerrit ─ Set Username & Email..................................................................................................................7
SET UP SSH KEYS IN GERRIT.........................................................................................................8
5. Gerrit ─ Generate New SSH Key ................................................................................................................9
6. Gerrit ─ Add Your SSH Key.......................................................................................................................10
7. Gerrit ─ Add SSH Key to Your Gerrit Account ..........................................................................................12
8. Gerrit ─ Add SSH Key to Use with Git ......................................................................................................15
9. Gerrit ─ Download Examples Using Git....................................................................................................16
PREPARE TO WORK WITH GERRIT.............................................................................................17
10. Gerrit ─ Installing Git-Review ..................................................................................................................18
11. Gerrit ─ Configuring Git-Review ..............................................................................................................21
12. Gerrit ─ Setting Up Git-Review................................................................................................................22
HOW TO SUBMIT A PATCH........................................................................................................23
13. Gerrit ─ Update Master...........................................................................................................................24
14. Gerrit ─ Create a Branch..........................................................................................................................25
15. Gerrit ─ Make & Commit Your Change ....................................................................................................26
16. Gerrit ─ Prepare Push Change Set to Gerrit.............................................................................................29
17. Gerrit ─ Push Your Change Set to Gerrit..................................................................................................30
Gerrit
iii
18. Gerrit ─ View the Change / Next Steps....................................................................................................31
19. Gerrit ─ Editing via the Web-Interface.....................................................................................................33
HOW CODE IS REVIEWED IN GERRIT .........................................................................................40
20. Gerrit ─ Review before Merge.................................................................................................................41
21. Gerrit ─ Project Owners ..........................................................................................................................42
22. Gerrit ─ How to Comment, Review, and Merge............................................. Error! Bookmark not defined.
Gerrit
1
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 to merge changes to Git repository, when you are done with the code
reviews.
Gerrit was developed by Shawn Pearce at Google which is written in Java, Servlet, GWT
(Google Web Toolkit). The stable release of Gerrit is 2.12.2 and published on March 11,
2016 licensed under Apache License v2.
Why Use Gerrit?
Following are certain reasons, why you should use Gerrit.
 You can easily find the error in the source code using Gerrit.
 You can work with Gerrit, if you have regular Git client; no need to install any Gerrit
client.
 Gerrit can be used as an intermediate between developers and git repositories.
Features of Gerrit
 Gerrit is a free and an open source Git version control system.
 The user interface of Gerrit is formed on Google Web Toolkit.
 It is a lightweight framework for reviewing every commit.
 Gerrit acts as a repository, which allows pushing the code and creates the review
for your commit.
Advantages of Gerrit
 Gerrit provides access control for Git repositories and web frontend for code review.
 You can push the code without using additional command line tools.
 Gerrit can allow or decline the permission on the repository level and down to the
branch level.
 Gerrit is supported by Eclipse.
1. Gerrit ─ Overview
Gerrit
2
Disadvantages of Gerrit
 Reviewing, verifying, and resubmitting the code commits, slows down the time to
market.
 Gerrit can work only with Git.
 Gerrit is slow and it's not possible to change the sort order in which changes are
listed.
 You need administrator rights to add repository on Gerrit.
Gerrit
3
Setting Up Gerrit
Gerrit
4
Before you can use Gerrit, you have to install Git and perform some basic configuration
changes. Following are the steps to install Git client on different platforms.
InstallationofGitClient
Linux
You can install the Git on Linux by using the software package management tool. For
instance, if you are using Fedora, you can use as:
sudo yum install git
If you are using Debian-based distribution such as Ubuntu, then use the following
command:
sudo apt-get install git
Windows
You can install Git on Windows by downloading it from the Git website. Just go
to msysgit.github.io link and click on the download button.
Mac
Git can be installed on Mac using the following command:
brew install git
Another way of installing Git is, by downloading it from Git website. Just go to Git install
on Mac link, which will install Git for Mac platform.
2. Gerrit ─ Installation
Gerrit
5
Once you have installed Git, you need to customize the configuration variables to add your
personal information. You can get and set the configuration variables by using Git tool
called git config along with the -l option (this option provides the current configuration).
git config -l
When you run the above command, you will get the configuration variables as shown in
the following image.
You can change the customized information any time by using the commands again. In
the next chapter, you will learn how to configure the user name and user Email by using
git config command.
3. Gerrit ─ Configure Git
Gerrit
6
You can track each commit by setting name and email variables. The name variable
specifies the name, while the email variable identifies the email address associated with
Git commits. You can set these using the following commands:
git config --global user.email "your_email@mail.com"
git config --global user.name "your_name"
When you run the above commands, you will get the user name and email address as
shown in the following image.
4. Gerrit ─ Set Username & Email
Gerrit
7
Set Up SSH Keys in Gerrit
Gerrit
8
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:
$ ls ~/.ssh
After clicking the enter button, you will see the existing SSH key as shown in the following
image:
If you don't find any existing SSH key, then you need to create a new SSH key.
Generating New SSH Key
You can generate a new SSH key for authentication using the following command in Git
Bash:
$ ssh-keygen -t rsa -C "your_email@mail.com"
If you already have a SSH key, then don't a generate new key, as they will be overwritten.
You can use ssh-keygen command, only if you have installed Git with Git Bash.
When you run the above command, it will create 2 files in the ~/.ssh directory.
 ~/.ssh/id_rsa: It is private key or identification key.
 ~/.ssh/id_rsa.pub: It is a public tv.
5. Gerrit ─ Generate New SSH Key
Gerrit
9
End of ebook preview
If you liked what you saw…
Buy it from our store @ https://store.tutorialspoint.com
Ad

Recommended

PPTX
Software architecture patterns
Md. Sadhan Sarker
 
PDF
Spring vs. spring boot
ChloeChoi23
 
PPTX
Spring boot Introduction
Jeevesh Pandey
 
PDF
LOG4J
Mourad HASSINI
 
PDF
Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Jav...
Edureka!
 
PDF
Java spring framework
Rajiv Gupta
 
PDF
Introduction to Spring Boot!
Jakub Kubrynski
 
PPTX
Java Spring framework, Dependency Injection, DI, IoC, Inversion of Control
Arjun Thakur
 
PPTX
STATE-MANAGEMENT-IN-FLUTTER-TECHNOLOGY.pptx
subairahamed52
 
PPTX
An Introduction to Maven
Vadym Lotar
 
PPT
Maven Introduction
Sandeep Chawla
 
PDF
Spring framework Introduction
Anuj Singh Rajput
 
PPTX
React hooks
Sadhna Rana
 
PPTX
Introduction to Spring Framework
Dineesha Suraweera
 
PPTX
Spring Boot and REST API
07.pallav
 
PPTX
WebSphere Application Server Family (Editions Comparison)
ejlp12
 
PPTX
Kubernetes PPT.pptx
ssuser0cc9131
 
PDF
Support distributed computing and caching avec hazelcast
ENSET, Université Hassan II Casablanca
 
PDF
Kubernetes - introduction
Sparkbit
 
PDF
Introduction to weblogic
Vishal Srivastava
 
PDF
Spring Boot Interview Questions | Edureka
Edureka!
 
PDF
Spring annotation
Rajiv Srivastava
 
PDF
Getting Started with Kubernetes
VMware Tanzu
 
PPTX
OpenStack Architecture and Use Cases
Jalal Mostafa
 
PDF
Deploying your first application with Kubernetes
OVHcloud
 
PDF
Spring Boot
HongSeong Jeon
 
PDF
Microservices, Containers and Docker
Ioannis Papapanagiotou
 
PPTX
Open Device Programmability: Hands-on Intro to RESTCONF (and a bit of NETCONF)
Cisco DevNet
 
PPTX
The-Git-Tutorial.ppt.pptx
MohammadSamiuddin12
 
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 3 - push change to gerrit
msohn
 

More Related Content

What's hot (20)

PPTX
STATE-MANAGEMENT-IN-FLUTTER-TECHNOLOGY.pptx
subairahamed52
 
PPTX
An Introduction to Maven
Vadym Lotar
 
PPT
Maven Introduction
Sandeep Chawla
 
PDF
Spring framework Introduction
Anuj Singh Rajput
 
PPTX
React hooks
Sadhna Rana
 
PPTX
Introduction to Spring Framework
Dineesha Suraweera
 
PPTX
Spring Boot and REST API
07.pallav
 
PPTX
WebSphere Application Server Family (Editions Comparison)
ejlp12
 
PPTX
Kubernetes PPT.pptx
ssuser0cc9131
 
PDF
Support distributed computing and caching avec hazelcast
ENSET, Université Hassan II Casablanca
 
PDF
Kubernetes - introduction
Sparkbit
 
PDF
Introduction to weblogic
Vishal Srivastava
 
PDF
Spring Boot Interview Questions | Edureka
Edureka!
 
PDF
Spring annotation
Rajiv Srivastava
 
PDF
Getting Started with Kubernetes
VMware Tanzu
 
PPTX
OpenStack Architecture and Use Cases
Jalal Mostafa
 
PDF
Deploying your first application with Kubernetes
OVHcloud
 
PDF
Spring Boot
HongSeong Jeon
 
PDF
Microservices, Containers and Docker
Ioannis Papapanagiotou
 
PPTX
Open Device Programmability: Hands-on Intro to RESTCONF (and a bit of NETCONF)
Cisco DevNet
 
STATE-MANAGEMENT-IN-FLUTTER-TECHNOLOGY.pptx
subairahamed52
 
An Introduction to Maven
Vadym Lotar
 
Maven Introduction
Sandeep Chawla
 
Spring framework Introduction
Anuj Singh Rajput
 
React hooks
Sadhna Rana
 
Introduction to Spring Framework
Dineesha Suraweera
 
Spring Boot and REST API
07.pallav
 
WebSphere Application Server Family (Editions Comparison)
ejlp12
 
Kubernetes PPT.pptx
ssuser0cc9131
 
Support distributed computing and caching avec hazelcast
ENSET, Université Hassan II Casablanca
 
Kubernetes - introduction
Sparkbit
 
Introduction to weblogic
Vishal Srivastava
 
Spring Boot Interview Questions | Edureka
Edureka!
 
Spring annotation
Rajiv Srivastava
 
Getting Started with Kubernetes
VMware Tanzu
 
OpenStack Architecture and Use Cases
Jalal Mostafa
 
Deploying your first application with Kubernetes
OVHcloud
 
Spring Boot
HongSeong Jeon
 
Microservices, Containers and Docker
Ioannis Papapanagiotou
 
Open Device Programmability: Hands-on Intro to RESTCONF (and a bit of NETCONF)
Cisco DevNet
 

Similar to Gerrit tutorial (20)

PPTX
The-Git-Tutorial.ppt.pptx
MohammadSamiuddin12
 
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 3 - push change to gerrit
msohn
 
PDF
Download ebooks file Learning Gerrit Code Review 1st Edition Milanesio all ch...
vankkagied
 
PDF
Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014
msohn
 
PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 01 - installation and conf...
msohn
 
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 9 - starting demo gerrit
msohn
 
PPTX
[Public] gerrit concepts and workflows
Yanbin Kong
 
PDF
Learning Gerrit Code Review 1st Edition Milanesio
qrjnysbvs275
 
PDF
EGit and Gerrit Code Review - Eclipse DemoCamp Bonn - 2010-11-16
msohn
 
PDF
Learning Gerrit Code Review 1st Edition Milanesio 2024 scribd download
tapangdieya
 
PPTX
2015-ghci-presentation-git_gerritJenkins_final
Mythri P K
 
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 4 - review change
msohn
 
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 7 - new changescreen
msohn
 
PDF
WordCamp KC 2014: Version Control Using Git
Frankie Jarrett
 
PPTX
Gerrit Code Review with GitHub plugin
Luca Milanesio
 
PDF
How Git and Gerrit make you more productive
Karsten Dambekalns
 
PDF
Gerrit Code Review
Johannes Barop
 
PDF
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
msohn
 
PDF
Gerrit linuxtag2011
thkoch
 
PDF
GWT Contributor Workshop
Manuel Carrasco Moñino
 
The-Git-Tutorial.ppt.pptx
MohammadSamiuddin12
 
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 3 - push change to gerrit
msohn
 
Download ebooks file Learning Gerrit Code Review 1st Edition Milanesio all ch...
vankkagied
 
Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014
msohn
 
Git Tutorial EclipseCon France 2014 - Git Exercise 01 - installation and conf...
msohn
 
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 9 - starting demo gerrit
msohn
 
[Public] gerrit concepts and workflows
Yanbin Kong
 
Learning Gerrit Code Review 1st Edition Milanesio
qrjnysbvs275
 
EGit and Gerrit Code Review - Eclipse DemoCamp Bonn - 2010-11-16
msohn
 
Learning Gerrit Code Review 1st Edition Milanesio 2024 scribd download
tapangdieya
 
2015-ghci-presentation-git_gerritJenkins_final
Mythri P K
 
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 4 - review change
msohn
 
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 7 - new changescreen
msohn
 
WordCamp KC 2014: Version Control Using Git
Frankie Jarrett
 
Gerrit Code Review with GitHub plugin
Luca Milanesio
 
How Git and Gerrit make you more productive
Karsten Dambekalns
 
Gerrit Code Review
Johannes Barop
 
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
msohn
 
Gerrit linuxtag2011
thkoch
 
GWT Contributor Workshop
Manuel Carrasco Moñino
 
Ad

More from HarikaReddy115 (20)

PDF
Dbms tutorial
HarikaReddy115
 
PDF
Data structures algorithms_tutorial
HarikaReddy115
 
PDF
Wireless communication tutorial
HarikaReddy115
 
PDF
Cryptography tutorial
HarikaReddy115
 
PDF
Cosmology tutorial
HarikaReddy115
 
PDF
Control systems tutorial
HarikaReddy115
 
PDF
Computer logical organization_tutorial
HarikaReddy115
 
PDF
Computer fundamentals tutorial
HarikaReddy115
 
PDF
Compiler design tutorial
HarikaReddy115
 
PDF
Communication technologies tutorial
HarikaReddy115
 
PDF
Biometrics tutorial
HarikaReddy115
 
PDF
Behavior driven development_tutorial
HarikaReddy115
 
PDF
Basics of computers_tutorial
HarikaReddy115
 
PDF
Basics of computer_science_tutorial
HarikaReddy115
 
PDF
Basic electronics tutorial
HarikaReddy115
 
PDF
Auditing tutorial
HarikaReddy115
 
PDF
Artificial neural network_tutorial
HarikaReddy115
 
PDF
Artificial intelligence tutorial
HarikaReddy115
 
PDF
Antenna theory tutorial
HarikaReddy115
 
PDF
Analog communication tutorial
HarikaReddy115
 
Dbms tutorial
HarikaReddy115
 
Data structures algorithms_tutorial
HarikaReddy115
 
Wireless communication tutorial
HarikaReddy115
 
Cryptography tutorial
HarikaReddy115
 
Cosmology tutorial
HarikaReddy115
 
Control systems tutorial
HarikaReddy115
 
Computer logical organization_tutorial
HarikaReddy115
 
Computer fundamentals tutorial
HarikaReddy115
 
Compiler design tutorial
HarikaReddy115
 
Communication technologies tutorial
HarikaReddy115
 
Biometrics tutorial
HarikaReddy115
 
Behavior driven development_tutorial
HarikaReddy115
 
Basics of computers_tutorial
HarikaReddy115
 
Basics of computer_science_tutorial
HarikaReddy115
 
Basic electronics tutorial
HarikaReddy115
 
Auditing tutorial
HarikaReddy115
 
Artificial neural network_tutorial
HarikaReddy115
 
Artificial intelligence tutorial
HarikaReddy115
 
Antenna theory tutorial
HarikaReddy115
 
Analog communication tutorial
HarikaReddy115
 
Ad

Recently uploaded (20)

PPTX
Values Education 10 Quarter 1 Module .pptx
JBPafin
 
PPTX
NSUMD_M1 Library Orientation_June 11, 2025.pptx
Julie Sarpy
 
PDF
HistoPathology Ppt. Arshita Gupta for Diploma
arshitagupta674
 
PPTX
How to Customize Quotation Layouts in Odoo 18
Celine George
 
PPTX
List View Components in Odoo 18 - Odoo Slides
Celine George
 
PDF
English 3 Quarter 1_LEwithLAS_Week 1.pdf
DeAsisAlyanajaneH
 
PDF
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
Kweku Zurek
 
PPTX
Wage and Salary Computation.ppt.......,x
JosalitoPalacio
 
PPTX
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
PPTX
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
 
PDF
Learning Styles Inventory for Senior High School Students
Thelma Villaflores
 
PDF
K12 Tableau User Group virtual event June 18, 2025
dogden2
 
PPTX
June 2025 Progress Update With Board Call_In process.pptx
International Society of Service Innovation Professionals
 
PDF
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
 
PPTX
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
IIT Kharagpur Quiz Club
 
PDF
Gladiolous Cultivation practices by AKL.pdf
kushallamichhame
 
PPTX
INDUCTIVE EFFECT slide for first prof pharamacy students
SHABNAM FAIZ
 
PPTX
Photo chemistry Power Point Presentation
mprpgcwa2024
 
PPTX
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT Kharagpur Quiz Club
 
PPT
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
ErlizaRosete
 
Values Education 10 Quarter 1 Module .pptx
JBPafin
 
NSUMD_M1 Library Orientation_June 11, 2025.pptx
Julie Sarpy
 
HistoPathology Ppt. Arshita Gupta for Diploma
arshitagupta674
 
How to Customize Quotation Layouts in Odoo 18
Celine George
 
List View Components in Odoo 18 - Odoo Slides
Celine George
 
English 3 Quarter 1_LEwithLAS_Week 1.pdf
DeAsisAlyanajaneH
 
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
Kweku Zurek
 
Wage and Salary Computation.ppt.......,x
JosalitoPalacio
 
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
 
Learning Styles Inventory for Senior High School Students
Thelma Villaflores
 
K12 Tableau User Group virtual event June 18, 2025
dogden2
 
June 2025 Progress Update With Board Call_In process.pptx
International Society of Service Innovation Professionals
 
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
 
Great Governors' Send-Off Quiz 2025 Prelims IIT KGP
IIT Kharagpur Quiz Club
 
Gladiolous Cultivation practices by AKL.pdf
kushallamichhame
 
INDUCTIVE EFFECT slide for first prof pharamacy students
SHABNAM FAIZ
 
Photo chemistry Power Point Presentation
mprpgcwa2024
 
IIT KGP Quiz Week 2024 Sports Quiz (Prelims + Finals)
IIT Kharagpur Quiz Club
 
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
ErlizaRosete
 

Gerrit tutorial

  • 2. Gerrit i AbouttheTutorial 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. Audience 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. Prerequisites 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-web- based applications. Copyright&Disclaimer  Copyright 2018 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at [email protected]
  • 3. Gerrit ii TableofContents About the Tutorial ............................................................................................................................................i Audience...........................................................................................................................................................i Prerequisites.....................................................................................................................................................i Copyright & Disclaimer.....................................................................................................................................i Table of Contents ............................................................................................................................................ ii 1. Gerrit ─ Overview......................................................................................................................................1 SETTING UP GERRIT ....................................................................................................................4 2. Gerrit ─ Installation...................................................................................................................................5 Installation of Git Client...................................................................................................................................5 3. Gerrit ─ Configure Git................................................................................................................................6 4. Gerrit ─ Set Username & Email..................................................................................................................7 SET UP SSH KEYS IN GERRIT.........................................................................................................8 5. Gerrit ─ Generate New SSH Key ................................................................................................................9 6. Gerrit ─ Add Your SSH Key.......................................................................................................................10 7. Gerrit ─ Add SSH Key to Your Gerrit Account ..........................................................................................12 8. Gerrit ─ Add SSH Key to Use with Git ......................................................................................................15 9. Gerrit ─ Download Examples Using Git....................................................................................................16 PREPARE TO WORK WITH GERRIT.............................................................................................17 10. Gerrit ─ Installing Git-Review ..................................................................................................................18 11. Gerrit ─ Configuring Git-Review ..............................................................................................................21 12. Gerrit ─ Setting Up Git-Review................................................................................................................22 HOW TO SUBMIT A PATCH........................................................................................................23 13. Gerrit ─ Update Master...........................................................................................................................24 14. Gerrit ─ Create a Branch..........................................................................................................................25 15. Gerrit ─ Make & Commit Your Change ....................................................................................................26 16. Gerrit ─ Prepare Push Change Set to Gerrit.............................................................................................29 17. Gerrit ─ Push Your Change Set to Gerrit..................................................................................................30
  • 4. Gerrit iii 18. Gerrit ─ View the Change / Next Steps....................................................................................................31 19. Gerrit ─ Editing via the Web-Interface.....................................................................................................33 HOW CODE IS REVIEWED IN GERRIT .........................................................................................40 20. Gerrit ─ Review before Merge.................................................................................................................41 21. Gerrit ─ Project Owners ..........................................................................................................................42 22. Gerrit ─ How to Comment, Review, and Merge............................................. Error! Bookmark not defined.
  • 5. Gerrit 1 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 to merge changes to Git repository, when you are done with the code reviews. Gerrit was developed by Shawn Pearce at Google which is written in Java, Servlet, GWT (Google Web Toolkit). The stable release of Gerrit is 2.12.2 and published on March 11, 2016 licensed under Apache License v2. Why Use Gerrit? Following are certain reasons, why you should use Gerrit.  You can easily find the error in the source code using Gerrit.  You can work with Gerrit, if you have regular Git client; no need to install any Gerrit client.  Gerrit can be used as an intermediate between developers and git repositories. Features of Gerrit  Gerrit is a free and an open source Git version control system.  The user interface of Gerrit is formed on Google Web Toolkit.  It is a lightweight framework for reviewing every commit.  Gerrit acts as a repository, which allows pushing the code and creates the review for your commit. Advantages of Gerrit  Gerrit provides access control for Git repositories and web frontend for code review.  You can push the code without using additional command line tools.  Gerrit can allow or decline the permission on the repository level and down to the branch level.  Gerrit is supported by Eclipse. 1. Gerrit ─ Overview
  • 6. Gerrit 2 Disadvantages of Gerrit  Reviewing, verifying, and resubmitting the code commits, slows down the time to market.  Gerrit can work only with Git.  Gerrit is slow and it's not possible to change the sort order in which changes are listed.  You need administrator rights to add repository on Gerrit.
  • 8. Gerrit 4 Before you can use Gerrit, you have to install Git and perform some basic configuration changes. Following are the steps to install Git client on different platforms. InstallationofGitClient Linux You can install the Git on Linux by using the software package management tool. For instance, if you are using Fedora, you can use as: sudo yum install git If you are using Debian-based distribution such as Ubuntu, then use the following command: sudo apt-get install git Windows You can install Git on Windows by downloading it from the Git website. Just go to msysgit.github.io link and click on the download button. Mac Git can be installed on Mac using the following command: brew install git Another way of installing Git is, by downloading it from Git website. Just go to Git install on Mac link, which will install Git for Mac platform. 2. Gerrit ─ Installation
  • 9. Gerrit 5 Once you have installed Git, you need to customize the configuration variables to add your personal information. You can get and set the configuration variables by using Git tool called git config along with the -l option (this option provides the current configuration). git config -l When you run the above command, you will get the configuration variables as shown in the following image. You can change the customized information any time by using the commands again. In the next chapter, you will learn how to configure the user name and user Email by using git config command. 3. Gerrit ─ Configure Git
  • 10. Gerrit 6 You can track each commit by setting name and email variables. The name variable specifies the name, while the email variable identifies the email address associated with Git commits. You can set these using the following commands: git config --global user.email "[email protected]" git config --global user.name "your_name" When you run the above commands, you will get the user name and email address as shown in the following image. 4. Gerrit ─ Set Username & Email
  • 11. Gerrit 7 Set Up SSH Keys in Gerrit
  • 12. Gerrit 8 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: $ ls ~/.ssh After clicking the enter button, you will see the existing SSH key as shown in the following image: If you don't find any existing SSH key, then you need to create a new SSH key. Generating New SSH Key You can generate a new SSH key for authentication using the following command in Git Bash: $ ssh-keygen -t rsa -C "[email protected]" If you already have a SSH key, then don't a generate new key, as they will be overwritten. You can use ssh-keygen command, only if you have installed Git with Git Bash. When you run the above command, it will create 2 files in the ~/.ssh directory.  ~/.ssh/id_rsa: It is private key or identification key.  ~/.ssh/id_rsa.pub: It is a public tv. 5. Gerrit ─ Generate New SSH Key
  • 13. Gerrit 9 End of ebook preview If you liked what you saw… Buy it from our store @ https://store.tutorialspoint.com