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

  1. Log in as the git OS user or the user you specified when configuring the Git Connector.

  2. Configure the webhook for mirroring:

    Copy the URL from your project's HTTP drop-down box.

    1. Set the environment variable GCONN_CONFIG to the absolute path to the gconn.conf file:

      export GCONN_CONFIG=/opt/perforce/git-connector/gconn.conf

    2. Add the web hook:

      gconn --mirrorhooks add graphDepotName/repoName https://access-token:secret@GerritHost.com/project/repoName.git

      where access-token:secret represents your personal access token for Gerrit.

  3. Save the secret token that the --mirrorhooks command 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

Next step

Testing the mirror hook