Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 Server Administration Documentation | 2025.1

# GitHub or GitLab SSH

## Prerequisites

- The target repo must NOT already exist in P4 Server.
- The source repo must not be empty.

## Configuration steps

1. On the Git Connector server, log in as the `root` user.

2. Create a `.ssh` directory:

   Ubuntu | CentOS
   --- | ---
   mkdir /var/www/.ssh | mkdir /usr/share/httpd/.ssh

3. Assign the owner of the directory:

   Ubuntu | CentOS
   --- | ---
   chown www-data:gconn-auth /var/www/.ssh | chown apache:gconn-auth /usr/share/httpd/.ssh

4. Switch user from `root` to the web service user for your platform:

   Ubuntu | CentOS
   --- | ---
   `su -s /bin/bash - www-data` | `su -s /bin/bash - apache`

   and generate the public and private SSH keys for the Git Connector instance:

   `ssh-keygen -t rsa -b 4096 -C web-service-user@gitConnector.com`

   where the web-service-user is either www-data for Ubuntu or apache for CentOS.

   then follow the prompts.

5. Locate the public key:

Ubuntu | CentOS
--- | ---
`/var/www/.ssh/id_rsa.pub` | /usr/share/httpd/.ssh/id_rsa.pub

6. Copy this public key to the GitLab or GitHub server and add to the user account (p4-user) that performs clone and fetch for mirroring.
7. Configure the webhook for mirroring:

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 git@GitHost.com/project/repoName.git``

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

9. Save the secret token that the `--mirrorhooks` command generates.

   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}

## Mirror a repo over SSH

1. Go to https://GitHost.com/project/repoName/hooks
2. Paste the URL of the Git Connector into the URL text box: https://GitConnector.com/mirrorhooks
3. Paste the webhook secret token in the Secret Token text box.
4. Uncheck Enable SSL verification.

5. Select events to trigger the webhook and click Add Webhook.

6. Click the lower-right corner Test button to validate the web hook is correctly set up.

Your search for returned results