Configure Gerrit for HTTP
Prerequisites
The target repo must NOT already exist in P4 Server.
The source repo must not be empty.
On the Git Connector server
-
Log in as the
gitOS user or the user you specified when configuring the Git Connector. -
Configure the webhook for mirroring:
Copy the URL from your project's HTTP drop-down box.
- Set the environment variable
GCONN_CONFIGto the absolute path to thegconn.conffile:export GCONN_CONFIG=/opt/perforce/git-connector/gconn.conf - Add the web hook:
gconn --mirrorhooks add graphDepotName/repoName https://access-token:secret@GerritHost.com/project/repoName.gitwhere access-token:secret represents your personal access token for Gerrit.
- Set the environment variable
- Save the secret token that the
--mirrorhookscommand generates, which is not related to the personal access token for Gerrit.
The secret token is also included in the repo spec on the P4 Server. To write the repo spec to standard output, run:
p4 repo -o {//graphDepotName/repoName}
On the Gerrit server
Update the configuration file for the Gerrit repository in the $GERRIT_SITE/git/repoName/config-file,where $GERRIT_SITE represents the root directory of your Gerrit server.
[gconn]
mirror-url = https://GitConnector.com/mirrorhooks
token = secret-token-from-repo-spec (p4 repo -o {//graphDepot/repoName})
git-http-url = upstream-url-from-repo-spec (p4 repo -o {//graph_depot/repo_name})
[gconn "http"]
sslverify = false