[Android Software/Hacking General [Developers Only]] pjgraber03:
Gerrit 2.11 Setup with Github Sign in​

So What is Gerrit?

If you want to know anything else about gerrit then head over to http://gerrit-review.googlesource.com/Documentation/

So lets jump right into setting up gerrit.

1. Getting together everything you need.

2. Getting system ready for installation.

3. Putting together everything and installing gerrit

Section 1: Getting together everything needed

First of you need to make sure have java installed on the system.

if you do not have java installed then go HERE

Next download the Gerrit 2.11 files

File 1: Gerrit-2.11.war

File 2: Github-oauth-2.11.jar

File 3: Github-plugin-2.11.jar

Last BUT MOST IMPORTANT

Make sure that you have registered a website domain (like with godaddy.com). Make sure the your dns zone file points your URL to the IP of the machine or server you will be using for gerrit.

Section 2: Getting system ready for installation.

Add Gerrit2 user and group to the system

sudo useradd gerrit2 && groupadd gerrit2

once you add the user go to the gerrit2 directory /home/gerrit2 and create a folder plugins and a folder lib

mkdir lib && mkdir plugins

Moving files(downloaded above) to the proper location

mv /download/location/gerrit2.11.war /home/gerrit2
mv /download/location/github-oauth-2.11.jar /home/gerrit2/lib
mv /download/location/github-plugin-2.11.jar /home/gerrit2/plugins

Install to git programs onto the system

sudo apt-get install gitweb
sudp apt-get install gitreview

Getting Github ready for gerrit

setup a new github account for example fubargerrit as a github account

once you are signed into gerrit under your new Github account go into settings.

if your setting up for team use be sure to add new github account to the team organization!!!!

next click on the applications...If your doing team click on the organization then on application.

Put in your url to your new gerrit site that you setup in the begining.

If you need visual support for this step I have a couple pictures

Picture 1

Picuture 2

Section 3: Putting together everything and installing Gerrit

Now you should have everything together that you need to get gerrit up and running.

Initiating Gerrit for this first time

you will need to change into the gerrit2 directory that you created earlier.

once in the gerrit2 directory you will need to run the following command

sudo java -jar gerrit-2.11.war init

that will open up into the Gerrit setup screen which will look something like this....

The following are just my options....You may wish to change at some point

*** Gerrit Code Review 2.11
***

*** Git Repositories
***

Location of Git repositories [git]:

*** SQL Database
***

Database server type [h2]:

*** Index
***

Type [LUCENE/?]:

*** User Authentication
***

Authentication method [HTTP/?]:
Get username from custom HTTP header [Y/n]?
Username HTTP header [GITHUB_USER]:
SSO logout URL :

*** Email Delivery
***

SMTP server hostname [localhost]:
SMTP server port [(default)]:
SMTP encryption [NONE/?]:
SMTP username :

*** Container Process
***

Run as [gerrit2]:
Java runtime [/usr/lib/jvm/java-7-openjdk-amd64/jre]:
Upgrade /home/gerrit2/bin/gerrit.war [Y/n]?
Copying gerrit-2.11.war to /home/gerrit2/bin/gerrit.war

*** SSH Daemon
***

Listen on address [*]:
Listen on port [29418]:

*** HTTP Daemon
***

Behind reverse proxy [y/N]?
Use SSL (https://) [y/N]?
Listen on address [*]:
Listen on port [8081]:
Canonical URL [http://]: enter your url HERE

*** Plugins
***

Installing plugins.
Install plugin download-commands version v2.11 [y/N]? Say Y
Install plugin reviewnotes version v2.11 [y/N]? say Y
Install plugin singleusergroup version v2.11 [y/N]? say Y
Install plugin replication version v2.11 [y/N]? say Y
Install plugin commit-message-length-validator version v2.11 [y/N]? say Y
Initializing plugins.

*** GitHub Integration
***

GitHub URL [https://github.com]:
GitHub API URL [https://api.github.com]:

NOTE: You might need to configure a proxy using http.proxy if you run Gerrit behind a firewall.

*** GitHub OAuth registration and credentials
***

Register Gerrit as GitHub application on:
https://github.com/settings/applications/new

Settings (assumed Gerrit URL: http://review.blissroms.com)
* Application name: Gerrit Code Review
* Homepage URL: http://yoururl.com
* Authorization callback URL: http://yoururl.com

After registration is complete, enter the generated OAuth credentials:
GitHub Client ID (This is where you will enter the client ID you got from github
GitHub Client Secret (Enter the secret you got from github)

After that gerrit should only need one last thing

cd in /home and run

sudo chown -R gerrit2:gerrit2 gerrit2

this will make all the files in the gerrit2 folder become owned by the gerrit2 user/group

Starting gerrit

Once back inside /home/gerrit2

run....

sudo bin/gerrit.sh start

That will start gerrit.....

To stop gerrit or restart gerrit the commands are...

sudo bin/gerrit.sh stop
or
sudo bin/gerrit.sh restart

All ran from /home/gerrit2 folder

If you run into a FAILED when starting up gerrit you can run

nano logs/error_log

to read the log file and find out what the error is.

One you get a OK when starting gerrit

go ahead and open you browser and type in your URL.

Setting up Gerrit WebUI

First thing is you need to sign in via github to your gerrit using the gerrit github user that you made in the beginning.

once you do that you need to go to your system and go to the /home/gerrit2 directory and run this

sudo su gerrit2
ssh-keygen ( just click enter till its done)
cat .ssh/id_rsa.pub

Some additional links that may provide some help for you

http://gerrit-review.googlesource.com/Documentation/

https://www.packtpub.com/books/conte...-gerrit-github

http://www.vogella.com/tutorials/Gerrit/article.html

https://gerrit.googlecode.com/svn/documentation/2.0/user-upload.html

XDA:DevDB Information

[GUIDE][GERRIT] Installation and configuration Gerrit v2.11 with GitHub Sign in, Tool/Utility for all devices (see above for details)

Contributors

pjgraber03, jackeagle

Version Information

Status: Stable

Created 2015-07-20

Last Updated 2015-07-24