> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sync.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Git Version Control Configuration

export const siteNameShort = "Sync";

export const siteName = "CData Sync";

You can configure Git version control to connect a {siteName} workspace to a Git repository and enable change tracking. Version control is configured per workspace. Each workspace connects to a single repository and branch, and this association cannot be changed after initialization.

Before you can configure version control, ensure that you meet the following requirements:

* access to a Git repository
* valid authentication credentials for that repository

## Configuring Git Version Control

To configure version control for your workspace:

1. Open your {siteNameShort} workspace.
2. Navigate to **Workspace Settings > Git Version Control**.

   <img src="https://mintcdn.com/cdata-sync/TKAiqQEyvbErXCWl/images/Git-Version-Control-Configuration_accessing-version-control-settings_1.png?fit=max&auto=format&n=TKAiqQEyvbErXCWl&q=85&s=d54085cf3c70a9e92fa378e6cd142c51" width="800" alt="Git Version Control settings page" data-path="images/Git-Version-Control-Configuration_accessing-version-control-settings_1.png" />

   This action opens the **Configure Git Version Control** dialog.

   <img src="https://mintcdn.com/cdata-sync/TKAiqQEyvbErXCWl/images/Git-Version-Control-Configuration_accessing-version-control-settings_2.png?fit=max&auto=format&n=TKAiqQEyvbErXCWl&q=85&s=e8b2a2d9af062fe42820b3eb12e3ed85" width="450" alt="Git Version Control dialog" data-path="images/Git-Version-Control-Configuration_accessing-version-control-settings_2.png" />
3. On the **Repo Details** page, specify repository connection and authentication details:
   * **Git Repository URL:** Enter the URL for your Git repository.
   * **Auth Scheme:** Select an authentication scheme.
     * **HTTPS:** For this scheme, specify the following options:
       * **Username:** Enter the account username for your remote Git hosting service (for example, GitHub, GitLab, or Azure DevOps).
       * **Password/Token:** Enter the password or personal access token (PAT) for your remote Git hosting service.

         <Note>
           * The PAT must have read and write permissions on your repository contents.
           * GitHub account passwords and read-only PATs cannot be used for push operations.
         </Note>
     * **SSH:** For this scheme, specify the following options:

       * **SSH Private Key:** Click **Choose File** to select a file that contains your SSH private key.
       * (Optional) **Passphrase:** Enter the passphrase that was set when the SSH private key was generated. If the private key is encrypted with a passphrase, you must enter it here so {siteNameShort} can decrypt and use the key. If the key was generated without a passphrase, leave this field blank.

       <Note>SSH authentication is available in {siteNameShort} Self-Hosted deployments only.</Note>
     * **OAuth:** For this scheme, click **Get Access Token**. If you are not already logged in to your Git hosting service, the Microsoft Azure login screen appears. After you authenticate, the confirmation message **Access token ready - save to apply** appears to the right of the **Get Access Token** button on the **Repo Details** page.

       <Note>OAuth authentication supports both setup and push operations without any additional configuration.</Note>
4. Click **Next** to move to the **Select Branch** page.
5. Select the branch for which you want version control from the **Branch** list, or click **Create New Branch** to create a new one.

   <img src="https://mintcdn.com/cdata-sync/TKAiqQEyvbErXCWl/images/Git-Version-Control-Configuration_accessing-version-control-settings_3.png?fit=max&auto=format&n=TKAiqQEyvbErXCWl&q=85&s=5b028ad5599b69d612bd3d4b5bdf0a79" width="450" alt="Select or create a branch" data-path="images/Git-Version-Control-Configuration_accessing-version-control-settings_3.png" />
6. Click **Next** to move to the **Complete Setup** page.
7. <a name="complete-setup" />On the **Complete Setup** page, verify that the selected branch is correct.

   <img src="https://mintcdn.com/cdata-sync/TKAiqQEyvbErXCWl/images/Git-Version-Control-Configuration_accessing-version-control-settings_4.png?fit=max&auto=format&n=TKAiqQEyvbErXCWl&q=85&s=2f2971f62fba31e278475eb6396ad01d" width="450" alt="Complete Setup page" data-path="images/Git-Version-Control-Configuration_accessing-version-control-settings_4.png" />

   If the selected branch already contains {siteNameShort} workspace settings, {siteNameShort} prompts you to import an encryption key, as shown below.

   <img src="https://mintcdn.com/cdata-sync/TKAiqQEyvbErXCWl/images/Git-Version-Control-Configuration_accessing-version-control-settings_5.png?fit=max&auto=format&n=TKAiqQEyvbErXCWl&q=85&s=17d735f7b35dc0f084da8395e98de1ed" width="450" alt="Import encryption key" data-path="images/Git-Version-Control-Configuration_accessing-version-control-settings_5.png" />

   Click **Choose File** and select the encryption key file for this repository.

   <Note>
     * If you have not yet exported the key from the original {siteNameShort} instance, see [Exporting an Encryption Key](#exporting-an-encryption-key) before proceeding.
     * If you provide the wrong password when you import the encryption key, {siteNameShort} displays an error and does not complete the setup.
   </Note>
8. Click **Complete Setup**.

After you exit the dialog, {siteNameShort} initializes version control for the workspace and connects to the specified repository and branch. You should see a category on the **Workspace Settings** page with your version control settings.

## Removing Version Control

To remove version control:

1. Navigate to **Workspace Settings > Git Version Control**.

   <img src="https://mintcdn.com/cdata-sync/IzPXzuYOg0g8nJPd/images/Git-Version-Control-Configuration_removing-version-control_1.png?fit=max&auto=format&n=IzPXzuYOg0g8nJPd&q=85&s=720665fe07f950409c82d18b34955597" width="800" alt="Version Control settings showing Remove icon" data-path="images/Git-Version-Control-Configuration_removing-version-control_1.png" />

2. <span>Click the **Remove** icon (<img src="https://mintcdn.com/cdata-sync/I6gJ4qR9mocXqHNN/images/Delete_TrashCan_icon.png?fit=max&auto=format&n=I6gJ4qR9mocXqHNN&q=85&s=549e259c81e80dedad151a6402f0e07a" style={{display: "inline", verticalAlign: "middle", margin: "0"}} alt="Remove icon" width="14" height="17" data-path="images/Delete_TrashCan_icon.png" />).</span>

Deleting the connection removes the association between the workspace and the Git repository.

## Exporting an Encryption Key

{siteNameShort} encrypts sensitive configuration data before committing it to the repository. This encryption key is created the first time a {siteNameShort} instance initializes version control for a repository and is specific to that repository.

If you connect a different {siteNameShort} instance to the same repository, that instance does not have access to the original encryption key. To give the new instance access, you must export the key from the original instance so that you can import it during the **Complete Setup** step.

To connect a new {siteNameShort} instance to an existing repository, you need to first export the encryption key from the original instance, then import it during <a href="#complete-setup">step 7 of the setup process</a>.

To export the encryption key from the original {siteNameShort} instance:

1. Open the {siteNameShort} instance that originally initialized the repository and navigate to the Git configuration area on the **Workspace Settings** page.

2. In the **Encryption Key** section, click **Export**.

   <img src="https://mintcdn.com/cdata-sync/I6gJ4qR9mocXqHNN/images/Git-Version-Control-Configuration-for-Workspaces_importing-encryption-key-when-connecting-to-existing-git-repository_1.png?fit=max&auto=format&n=I6gJ4qR9mocXqHNN&q=85&s=71c38e03334a47f0ab132ff1cc013b75" width="450" alt="Encryption Key section with Export button" data-path="images/Git-Version-Control-Configuration-for-Workspaces_importing-encryption-key-when-connecting-to-existing-git-repository_1.png" />

3. In the **Export Encryption Key** dialog, enter a password to protect the exported key file.

   <img src="https://mintcdn.com/cdata-sync/I6gJ4qR9mocXqHNN/images/Git-Version-Control-Configuration-for-Workspaces_importing-encryption-key-when-connecting-to-existing-git-repository_2.png?fit=max&auto=format&n=I6gJ4qR9mocXqHNN&q=85&s=a774fc3485267881abd7835f9c79bfcf" width="450" alt="Export Encryption Key dialog" data-path="images/Git-Version-Control-Configuration-for-Workspaces_importing-encryption-key-when-connecting-to-existing-git-repository_2.png" />

4. Click **Export**.

## Known Limitations and Issues

Git version control has the following limitations:

* A workspace can be connected only to one branch.
* The configured branch cannot be changed after initialization.

The following issue can also occur when you remove version control:

* In some environments, removing version control can fail if repository files cannot be removed due to file permissions. This situation can occur when files in the `.git` directory are read-only.
* If this issue occurs, you might need to manually remove the repository files before reconnecting version control.
