GitHub or GitLab SSH
The target repo must NOT already exist in Helix Core Server.
The source repo must not be empty.
-
On the Git Connector server, log in as the
root
user. - Create a
.ssh
directory:Ubuntu CentOS mkdir /var/www/.ssh mkdir /usr/share/httpd/.ssh - Assign the owner of the directory to be the
web-service-user
:Ubuntu CentOS chown web-service-user:gconn-auth /var/www/.ssh chown web-service-user:gconn-auth /usr/share/httpd/.ssh -
Switch user from
root
to theweb-service-user
: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
then follow the prompts.
-
Locate the public key:
-
Copy this public key to the GitLab or GitHub server and add to the user account (helix-user) that performs clone and fetch for mirroring.
- Configure the webhook for mirroring:
- Set the environment variable
GCONN_CONFIG
to the absolute path to thegconn.conf
file:export GCONN_CONFIG=/opt/perforce/git-connector/gconn.conf
- Add the web hook:
gconn --mirrorhooks add graphDepotName/repoName git@GitHost.com/project/repoName.git
where access-token:secret represents your personal access token for GitHub or GitLab.
-
Save the secret token that the
--mirrorhooks
command generates.TipThe secret token is also stored in
/opt/perforce/git-connector/repos/graphDepotName/repoName.git/.mirror.config
Ubuntu | CentOS |
---|---|
|
/usr/share/httpd/.ssh/id_rsa.pub |
Copy the URL from your project's SSH drop-down box.
Mirror a repo over SSH
- Go to https://GitHost.com/project/repoName/hooks
- Paste the URL of the Git Connector into the URL text box: https://GitConnector.com/mirrorhooks
- Paste the webhook secret token in the Secret Token text box.
- Uncheck Enable SSL verification.
-
Select events to trigger the webhook and click Add Webhook.
- Click the lower-right corner Test button to validate the web hook is correctly set up.