> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/use-gitops/gitops-entities/repositories/add-harness-git-ops-repository-credentials-template.md).

# GitOps Repository Credentials Template

Create a single GitOps repository credentials template and apply it to all GitOps repositories.

This topic describes how to set up a GitOps repository credentials template.

Harness GitOps repositories are connections to repos containing the declarative description of a desired state. The declarative description can be in Kubernetes manifests, Helm Chart, Kustomize manifests, etc.

If you are using multiple Harness GitOps repositories for the subfolders in the same Git or Helm repository, you do not want to add the same credentials multiple times. Instead, you can create a single GitOps repository credentials template and select it when creating GitOps repositories.

A Harness GitOps repository is used for Harness GitOps only. For other Harness features like Continuous Integration (CI) or Continuous Delivery (CD) pipelines, use a standard [Git Connector](https://developer.harness.io/docs/platform/connectors/code-repositories/ref-source-repo-provider/git-connector-settings-reference).

## What you will learn from this topic <a href="#what-you-will-learn-from-this-topic" id="what-you-will-learn-from-this-topic"></a>

* How to create a [GitOps repository credentials template](#step-1-create-gitops-repository-credentials-template) for Git or HTTP Helm repositories.
* How to apply the template to [multiple GitOps repositories](#review-gitops-repository) to avoid duplicating credentials.
* How to choose an authentication option for your Git provider: HTTPS, SSH, or GitHub App.
* How to configure proxy settings and optionally [skip server verification](#option-skip-server-verification).

## Before you begin <a href="#before-you-begin" id="before-you-begin"></a>

* Go to [Harness GitOps Basics](/continuous-delivery/use-gitops/get-started/harness-git-ops-basics.md) to understand core GitOps concepts.
* Go to [Harness CD GitOps Quickstart](/continuous-delivery/use-gitops/get-started/harness-cd-git-ops-quickstart.md) to complete an end-to-end GitOps walkthrough.
* Go to [Install a Harness GitOps Agent](/continuous-delivery/use-gitops/gitops-entities/agents/install-a-harness-git-ops-agent.md) to set up the Agent this template syncs through.
* Go to [Add a Harness GitOps repository](/continuous-delivery/use-gitops/gitops-entities/repositories/add-a-harness-git-ops-repository.md) to review how individual repositories are added.

## Limitations <a href="#limitations" id="limitations"></a>

* Only Git platforms and HTTP Helm servers are supported in a GitOps repository.

## Repository path requirements <a href="#review-gitops-repository" id="review-gitops-repository"></a>

Go to [Add a Harness GitOps repository](/continuous-delivery/use-gitops/gitops-entities/repositories/add-a-harness-git-ops-repository.md) to review how individual repositories are added.

If you use a GitOps repository credentials template with a GitOps repository, then the repository path in the GitOps repository must be a subfolder of the repository path in the repository credentials template.

## Create a GitOps repository credentials template <a href="#step-1-create-gitops-repository-credentials-template" id="step-1-create-gitops-repository-credentials-template"></a>

In the GitOps repository credentials template setup, you will select the [Agent](/continuous-delivery/use-gitops/gitops-entities/agents/install-a-harness-git-ops-agent.md) to use when syncing state. Be sure you have a GitOps Agent set up already.

Go to [Install a Harness GitOps Agent](/continuous-delivery/use-gitops/gitops-entities/agents/install-a-harness-git-ops-agent.md) to set up an Agent.

You will also provide the credentials to use when connecting to the Git repository. Have your credentials available.

1. In your Harness project, select **GitOps**, and then select **Settings**.
2. Select **Repositories**.
3. Select **Create Credential Template**.
4. In **Specify Repository Type**, select **Git** or **Helm**.

### Option 1: Git providers <a href="#option-git-providers" id="option-git-providers"></a>

1. Select **Git**.
2. In **Repository Name**, enter a name.
3. In **GitOps Agent**, select or create the Agent you want to use to fetch manifests from this repository. Go to [Install a Harness GitOps Agent](/continuous-delivery/use-gitops/gitops-entities/agents/install-a-harness-git-ops-agent.md) to set up an Agent.
4. In **Repository URL**, enter the URL to your repository. For example, `https://github.com/argoproj`.

   Typically, you will enter the URL to the root of the repository. Harness GitOps repositories that use this template will use subfolders of that path for their **URL** settings.
5. Select **Continue**.
6. In **Credentials**, select one of the following:
   * Specify Credentials for Repository
     * In **Credentials**, in **Connection Type**, select **HTTPS**, or **SSH**, or **GitHub App**.
       * If you use Two-Factor Authentication for your Git repository, you connect over **HTTPS** or **SSH**.
       * For **SSH**, use a PEM-format key, not OpenSSH. To generate an SSHv2 key, use: `ssh-keygen -t rsa -m PEM` The `rsa` and `-m PEM` options select the algorithm and the PEM format. Follow the prompts to create the PEM key.
       * Go to the [ssh-keygen man page](https://linux.die.net/man/1/ssh-keygen) to review the command options.
       * **HTTP** also has the **Anonymous** option.
     * Go to [Use a GitHub App in a GitHub Connector](https://developer.harness.io/docs/platform/connectors/code-repositories/git-hub-app-support) to set up the GitHub App.
     * Select **Save & Continue**. Harness validates the connection.
   * Enable LFS support

     This option is available if you selected **HTTP**.

     Select the option to use [Git Large File Storage](https://github.com/git-lfs/git-lfs/).
   * Proxy

     This option is available if you selected **HTTP**.

     A proxy for your repository can be specified in the Proxy setting.

     Harness uses this proxy to access the repository. Harness looks for the standard proxy environment variables in the repository server if the custom proxy is absent.

     An example repository with proxy:

     ```yaml
     apiVersion: v1
     kind: Secret
     metadata:
       name: private-repo
       namespace: cd
       labels:
         argocd.argoproj.io/secret-type: repository
     stringData:
       type: git
       url: https://github.com/argoproj/private-repo
       proxy: https://proxy-server-url:8888
       password: my-password
       username: my-username
     ```

### Option 2: HTTP Helm repository <a href="#option-http-helm-repository" id="option-http-helm-repository"></a>

1. Select **Helm**.
2. In **Repository Name**, enter a name.
3. In **GitOps Agent**, select or create the Agent you want to use to fetch charts from this repository. Go to [Install a Harness GitOps Agent](/continuous-delivery/use-gitops/gitops-entities/agents/install-a-harness-git-ops-agent.md) to set up an Agent.
4. In **Repository URL**, enter the URL to your HTTP Helm repository. For example, `https://charts.bitnami.com/bitnami`.
5. Select **Continue**.
6. In **Credentials**, in **Connection Type**, select **HTTPS** or **SSH**.
   * If you use Two-Factor Authentication for your Git repository, you connect over **HTTPS** or **SSH**.
   * For **SSH**, use a PEM-format key, not OpenSSH. To generate an SSHv2 key, use: `ssh-keygen -t rsa -m PEM` The `rsa` and `-m PEM` options select the algorithm and the PEM format. Follow the prompts to create the PEM key.
   * Go to the [ssh-keygen man page](https://linux.die.net/man/1/ssh-keygen) to review the command options.
   * **HTTP** also has the **Anonymous** option.
7. Select **Save & Continue**. Harness validates the connection.
8. Select **Finish**. You now have a Harness GitOps repository credentials template.

### Skip server verification <a href="#option-skip-server-verification" id="option-skip-server-verification"></a>

Select this option to have the GitOps Agent skip verification of the URL and credentials.

Verification is only skipped when you create the GitOps repository credentials template. Subsequent uses of the GitOps repository credentials template are verified.

## Finish setting up the template <a href="#step-2-finish" id="step-2-finish"></a>

If you encounter errors, check that you have the correct repository URL and your authentication method has the required permissions.

1. Select **Finish**. You now have a Harness GitOps repository credentials template.
2. You can view templates in the **Credential Templates** list in GitOps **Repositories**.

![](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-589c1e6d97fb3d6b3133810a920cafeafa639442%2Fadd-harness-git-ops-repository-credentials-template-25.png?alt=media)

## Next steps <a href="#next-steps" id="next-steps"></a>

* [Add a Harness GitOps repository](/continuous-delivery/use-gitops/gitops-entities/repositories/add-a-harness-git-ops-repository.md): Apply the credentials template when creating a new repository connection.
* [Install a Harness GitOps Agent](/continuous-delivery/use-gitops/gitops-entities/agents/install-a-harness-git-ops-agent.md): Set up the Agent required by the template.
* [Harness CD GitOps Quickstart](/continuous-delivery/use-gitops/get-started/harness-cd-git-ops-quickstart.md): Complete an end-to-end walkthrough of a GitOps deployment.

{% @harness-feedback/feedback %}
