Skip to main content

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.

important

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

This topic explains how to configure OAuth for GitHub.

To configure your credentials for Git:

  1. Go to your user profile in Harness.

  2. In Connect to a Git Provider, select GitHub.

  3. Select Connect. The OAuth settings for the selected Git provider appear.

  4. Select Authorize. Harness fetches the corresponding OAuth token associated with the Git provider and displays it under Access token for Git providers.

note

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:

  1. Go to an existing remote pipeline or create a new one.

  2. Edit the pipeline and select Save. The Save Pipelines to Git settings appear. Harness displays the user name being used for this commit.

  3. Select Save.

    important

    If 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.

  4. Go to your branch in the Git repository. It now displays the author details beside the commit.