This topic provides settings and permissions for the GitLab Connector.
- Before Harness syncs with your Git repo, it will confirm that all Harness' settings are in a valid state. If a connection is not working, Harness will not sync with your Git repo.
The unique name for this Connector.
See Tags Reference.
You can select Git Account or Git Repository.
You can add a connection to your entire Git account or just a repo in the account. Selecting a Git account enables you to use one Connector for all of your subordinate repos.
Later when you test this connection, you will use a repo in the account.
In either case, when you use the Connector later in Harness, you will specify which repo to use.
You can select HTTPS or SSH for the connection.
You will need to provide the protocol-relevant URL in GitLab Account URL.
If you use Two-Factor Authentication for your Git repo, you connect over HTTPS or SSH. HTTPS requires a personal access token.
For SSH, ensure that the key is not OpenSSH, but rather RSA or another algorithm. To generate an SSHv2 key, use:
ssh-keygen -t rsa -m PEM The
-m PEM ensure that the key is RSA. Next, follow the prompts to create the PEM key. For more information, see the ssh-keygen man page.To sync with GitLab, you will need to generate a SSH key pair and add the SSH key to your GitLab account. For more information, see Generating a new SSH key pair from GitLab.
GitLab Account or Repo URL
The URL for your Git repo. Ensure that it matches the Connection Type option you selected.
If you selected Repository in Type, enter the full URL for the repo. For example:
You can get the URL from the Clone button in your repo.
If you selected Account in Type, enter the URL without the repo name. When you use this Connector in a Harness setting you will be prompted to provide a repo name.
You can use a password/token for HTTPS credentials. Typically, a token is used.
If you selected SSH as the connection protocol, you must add the SSH Key for use with the connection.
Enter the username git. Do not enter any other value.
git is the only value you should use in Username.
Password/Personal Access Token
Enter a Harness Encrypted Text secret for the credentials of your GitLab user account.
Typically, a Personal Access Token is used. See Personal Access Tokens from GitLab.
The Personal Access Token requirements for Harness are:
If you selected SSH as the connection protocol, you must add the SSH Key for use with the connection as a Harness Encrypted Text secret.
See Use SSH keys to communicate with GitLab from GitLab.
Enable API access
This option is required for using Git-based triggers, Git Sync, and updating Git statuses.
You'll need this setting if you use Harness Git Experience.
Simply use the same Personal Access Token you created earlier.