This plugin allows existing GitHub repositories to be integrated as Gerrit projects. This plugin works for Gerrit 2.12 and later versions. See the original opensource project for more information.
- Download the Gerrit 2.12 war file.
- Create a directory for Gerrit
mkdir gerrit
- Place the
gerrit.war
file in your gerrit directory. - Run
java -jar gerrit*.war init
and configure.
- Visit GitHub to Register a New Application
- Copy Client ID and Client Secret. These will be needed for plugin configuration.
- Download the github-oauth.jar and github-plugin.jar Gerrit plugins
- Rename oauth library to
github-oauth.jar
and place it inGERRIT_ROOT/lib
- Rename plugin to
github-plugin.jar
and place it inGERRIT_ROOT/plugins
- Run
java -jar gerrit*.war init
to reconfigure. See examplegerrit.config
below to help configure your instance with correct values. - Run
java -jar gerrit*.war reindex
- Start gerrit with
GERRIT_ROOT/bin/gerrit.sh start
- Go to your Gerrit Home Page and test it out !
- Checkout more details on Oauth Token's scope
[gerrit]
basePath = git
canonicalWebUrl = http://<somewhere.company.com>:8080/
[database]
type = h2
database = <gerrit_root_path>/db/ReviewDB
[index]
type = LUCENE
[auth]
type = HTTP
httpHeader = GITHUB_USER
logoutUrl = /oauth/reset
httpExternalIdHeader = GITHUB_OAUTH_TOKEN
loginUrl = /login
loginText = Sign-in with GitHub
registerPageUrl = "/#/register"
[receive]
enableSignedPush = true
[sendemail]
smtpServer = localhost
[container]
user = <your_gerrit_user>
javaHome = /usr/lib/jvm/jdk1.7.0_79/jre
[sshd]
listenAddress = <somewhere.company.com>:29418
[httpd]
listenUrl = http://<somewhere.company.com>:8080/
filterClass = com.googlesource.gerrit.plugins.github.oauth.OAuthFilter
[cache]
directory = cache
[github]
url = https://github.com
apiUrl = https://api.github.com
clientId = <your_application_clientID>
scopes = USER_EMAIL,REPO,READ_ORG