GitHub Connector Settings Reference

Updated 1 month ago by Michael Cretzman

This topic provides settings and permissions for the GitHub Connector.

You can also use a GitHub App for authentication in a Harness GitHub Connector. See Use a GitHub App in a GitHub Connector.

In this topic:

Limitations

  • One Harness Application cannot be in multiple repos.
  • 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—for example, a connection to an Artifact Repo or Cloud Provider—Harness will not sync with your Git repo.

Name

The unique name for this Connector.

ID

See Entity Identifier Reference.

Description

Text string.

Tags

See Tags Reference.

URL Type

You can select Git Account (which is a GitHub organization) or Git Repository.

You can add a connection to your entire Git org or just a repo in the org. Selecting a Git org 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 org.

In either case, when you use the Connector later in Harness, you will specify which repo to use.

Connection Type

You can select HTTPS or SSH for the connection.

You will need to provide the protocol-relevant URL in URL.

If you use Two-Factor Authentication for your Git repo, you connect over HTTPS or SSH. HTTPS is required a personal access token.

For SSH, ensure that the key is not OpenSSH, but rather PEM format. To generate an SSHv2 key, use: ssh-keygen -t rsa -m PEM The rsa and -m PEM ensure the algorithm and that the key is PEM. Next, follow the prompts to create the PEM key. For more information, see the ssh-keygen man page and Connecting to GitHub with SSH.

GitHub Org or Repo URL

The GitHub URL is the URL for a Git org or repo. Ensure that it matches the Connection Type option you selected.

If you selected Git Repository in URL Type, enter the full URL for the repo, such as https://github.com/org-name/repo-name.

If you selected Git Account in URL Type, enter the URL without the repo name, like https://github.com/org-name. When you use this Connector in a Harness setting you will be prompted to provide a repo name.

For example, here are the HTTPS and SSH URLs from Github:

Authentication

Readonly GitHub repos also require username and password/token.

You can use a password/token for HTTPS credentials.

If you selected SSH as the connection protocol, you must add the SSH Key for use with the connection. 

Username

Your personal GitHub account username.

Password/Personal Access Token

A Harness Encrypted Text secret for the credentials of your GitHub user account.

A Personal Access Token (PAC) is required if your GitHub authentication uses 2FA.

Typically, you can validate your token from the command line before using it in Harness. For example:

curl -i https://api.github.com -u <username>:<token>

If you've set up Two-Factor Authentication in your Git repo, then you need to generate a personal access token in your repo and enter that token in the Password/Token field. In GitHub, you can set up the personal access token at https://github.com/settings/tokens/new.
For SSH, ensure that the key is not OpenSSH, but rather PEM format. To generate an SSHv2 key, use: ssh-keygen -t rsa -m PEM The rsa and -m PEM ensure the algorithm and that the key is PEM. Next, follow the prompts to create the PEM key. For more information, see the ssh-keygen man page and Connecting to GitHub with SSH.

PAC Permissions

GitHub doesn't provide a way of scoping a PAC for read-only access to repos. You must select the repo scope with full control of private repositories.

SSH Key

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.

Harness also supports GitHub deploy keys. Deploy keys grant access to a single repo. Using a deploy key ensures that the Connector only works with the specific repo you selected in URL Type.

Enable API access

This option is required for using Git-based triggers, Webhooks management, and updating Git statuses.

API Authentication

A Harness Encrypted Text secret for the credentials of your GitHub user account.


Please Provide Feedback