Connecting a GitHub Repository
Overview
This article shows you how to connect your GitHub repository to DevOps so that Salesforce metadata managed in DevOps branches syncs automatically with your GitHub repository. This ensures that your branches, commits, and pull requests are fully tracked in your Git-based version control system.
GitHub Personal Access Tokens
DevOps connects to a GitHub repository using a Personal Access Token. You can use either a Classic token or a Fine-Grained token, depending on your company's requirements. The instructions below cover both methods, but you only need to create one type of token.
GitHub Prerequisites
Repository
The DevOps-to-GitHub integration syncs all branches, commits, and pull requests to a single GitHub repository. This repository can be public or private and can be owned by an organization or an individual user.
The screenshot below shows a private repository flosum-devops-example that is part of the Flosum-Example organization.

Personal Access Token - Classic
Log in to your GitHub account.
Click your profile picture in the upper-right corner to open the dropdown menu.
Click Settings.
Access Developer settings > Personal access tokens > Tokens (classic).
Click the Generate new token dropdown menu.
Click Generate new token (classic).

Enter a description of the token in the Note textbox.
Click the Expiration dropdown and select the date when you want the token to expire.
Select the following Scopes:
repo
workflow

Click Generate token at the bottom of the page.
Copy the token and save it securely. You will need this token when connecting DevOps to your GitHub account.
Personal Access Token - Fine-Grained
Log in to your GitHub account.
Click your profile picture in the upper-right corner to open the dropdown menu.
Click Settings.
Access Developer settings > Personal access tokens > Fine-grained tokens.
Click Generate new token.

Enter a name for the token in the Token name textbox.
Click the Resource owner dropdown and select the user or organization that owns the repository this token is for.
Click the Expiration dropdown and select the date when you want the token to expire.
Under Repository access, select Only select repositories to limit the scope of this token to only the repositories you select.
Click the Select repositories dropdown and check all the repositories to include with this token.

Under Permissions, click Add permissions to add each of the permissions in the table below.
Set the Access dropdown for each permission to match the Access column in the table below.
Administration
Read and write
Contents
Read and write
Metadata
Read-only
Webhooks
Read and write
Click Generate token.

Review the token's settings in the confirmation dialog and click Generate token.
Copy the token and save it securely. You will need this token when connecting DevOps to your GitHub account.
Connect DevOps to GitHub
Connect GitHub
Click the Service type dropdown menu.
Select GitHub.

In the Organization textbox, enter the GitHub organization name that owns the repository you are connecting to. Leave blank if connecting to a repository owned by your GitHub user account.
Repository Path
The GitHub repository path the integration tries to connect to depends on whether the Organization field has a value.
If the Organization field has a value, the repository path is:
github.com/{Organization}/{Repository name}
If the Organization field is blank, the repository path is:
github.com/{Username}/{Repository name}
In the Username textbox, enter the GitHub username you are connecting this integration with.
In the Token textbox, enter the GitHub Personal Access Token you created in the section above.
In the Repository name textbox, enter the name of the GitHub repository you are connecting to.

Click Connect.

If the Git integration connects to your GitHub repository successfully, a success message appears. The GitHub connection then lists the organization and shows its status as Connected.

If the Git integration connection fails, check the error message to determine the cause. Once fixed, try connecting again.
Last updated
Was this helpful?


