How to Disable NextGen Git Experience using API

This document walks you through the steps to follow to Disable NextGen Git Experience using API.

We have an API to disable Git Experience as currently we do not have a feature to disable Git Experience using UI. So, as part of this API,

  • We will remove all the YamlGitConfigs (repos) synced in a particular scope.

  • We will delete GitSyncSettings for that scope, so that whenever user enables git-sync again on that scope the experience will remain same.

  • We will delete Setup Usages of reference Git Connector and YamlGitConfigs, so that if user wants, he can delete that Git connector.

  • We will delete all the branches from our db (gitBranches), if the repo synced in this scope is not synced in any other scope, so that user can again choose which branch he wants to sync in harness when he enables git-exp for same repo.

  • Nothing will change in regard to entities which are git-synced.

Curl of this API -

curl --location --request PUT 'https://app.harness.io/gateway/ng/api/git-sync/disable?accountIdentifier={{accountId}}&orgIdentifier={{orgId}}&projectIdentifier={{projectID}}' \
--header 'Authorization: Bearer {{bearer token}}' \

Required Params:

  1. accountIdentifier

  2. orgIdentifier

  3. projectIdentifier

  4. Bearer Token of User is also required.

Demo:

  1. Go to Git Experience enabled project :
  2. Take accountIdentifier, orgIdentifier and projectIdentifier from the URL
  3. Capture the Bearer Token from Chrome The kebab menu, also known as the three dots menu → More tools → Network → Click anywhere in your Harness UI → expand the Headers → Request Headers → Authorization copy the bearer token
  4. curl --location --request PUT 'https://app.harness.io/gateway/ng/api/git-sync/disable?accountIdentifier=(accountIdentifier)&orgIdentifier=(orgIdentifier)&projectIdentifier=(projectIdentifier)' \ --header 'Authorization: Bearer (token)' \
  5. Now you can see Git Experience has been removed from the project :

These are the steps we need to follow to Disable NextGen Git Experience using API.

1 Like