Integrate OAuth with Git experience
You can store configurations for your resources, such as pipelines and input sets, in Git using Harness Git Experience. Harness fetches user credentials from the Harness account and uses the corresponding user name as the author of the commit.
You can push configuration changes using your own credentials by integrating OAuth with Git. When you integrate OAuth with Git Experience, the credentials are stored in your Harness account user profile. These credentials are used for any subsequent commits.
Harness will continue to use the user name corresponding to the account if you don't integrate OAuth with Git Experience.
This topic explains how to configure OAuth for Git Experience in Harness.
Configure OAuth for Git provider
Harness supports OAuth integration for the following Git providers:
- GitHub
- GitLab
- Bitbucket SaaS
Harness does not support OAuth integration for Azure repos. Additionally, please note that we don't support OAuth for On-prem GIT systems.
This topic explains how to configure OAuth for GitHub.
To configure your credentials for Git:
-
Go to your user profile in Harness.
-
In Connect to a Git Provider, select GitHub.
-
Select Connect. The OAuth settings for the selected Git provider appear.
-
Select Authorize. Harness fetches the corresponding OAuth token associated with the Git provider and displays it under Access token for Git providers.
You can delete access tokens you no longer need. Under Access tokens for Git providers, select the trash can icon that corresponds to the Git provider token you want to delete. A confirmation message appears, asking if you want to delete the SCM. After you confirm, Harness removes the configuration.
Commit changes to Git with the configured OAuth token
To commit changes to Git using the configured OAuth token:
-
Go to an existing remote pipeline or create a new one.
-
Edit the pipeline and select Save. The Save Pipelines to Git settings appear. Harness displays the user name being used for this commit.
-
Select Save.
importantIf you have not configured OAuth for Git, Harness prompts you to set up an access token in the user profile to use for Git commits. You can do one of the following to commit your changes to Git:
-
Select Connect to configure OAuth for Git and use your Git credentials for the commit, and then select Save. This is optional.
-
Select Save to use the credentials from the Git connector for the commit.
-
-
Go to your branch in the Git repository. It now displays the author details beside the commit.