Skip to main content

Overview

Argo CD repository credentials are stored in Kubernetes Secrets with the label argocd.argoproj.io/secret-type: repository. This guide covers how to configure repository connections using HTTPS, SSH, GitHub Apps, and Google Cloud Source repositories.
Some Git hosters (notably GitLab) require you to specify the .git suffix in the repository URL, otherwise they will send a HTTP 301 redirect. Argo CD will not follow these redirects.

Repository Secret Structure

Each repository Secret must have:
  • A url field containing the repository URL
  • Authentication credentials (varies by connection type)
  • Optional project field to scope credentials to a specific project
  • The label argocd.argoproj.io/secret-type: repository

HTTPS Repositories

Connect to repositories using username and password authentication:

With Proxy Configuration

Specify proxy settings for repository access:
Not all tools support the same noProxy syntax. If having issues, try using full domain names instead of wildcards or IP ranges.

SSH Repositories

Connect using SSH private keys:
See the Kubernetes documentation for instructions on creating a secret containing a private key.

GitHub App Authentication

Use GitHub Apps for repository access:

GitHub Enterprise

Google Cloud Source Repositories

Authenticate using GCP service account keys:

Repository Credential Templates

Use credential templates to share the same credentials across multiple repositories. Credentials are applied to repositories with matching URL prefixes.
Matching credential template URL prefixes is done on a best match basis. The longest matching prefix takes precedence.

TLS Certificates

Configure custom TLS certificates for repositories using self-signed certificates or custom CAs in the argocd-tls-certs-cm ConfigMap:
The hostname part of the repository URL (e.g., server.example.com from https://server.example.com/repos/my-repo) is used as the key.

SSH Known Hosts

For SSH repositories, configure known host keys in the argocd-ssh-known-hosts-cm ConfigMap:
Generate keys using ssh-keyscan:

Credential Fields Reference

SSH Repositories

  • sshPrivateKey: SSH private key for authentication

HTTPS Repositories

  • username: Username for authentication
  • password: Password for authentication
  • tlsClientCertData: TLS client certificate
  • tlsClientCertKey: TLS client certificate private key

GitHub App Repositories

  • githubAppPrivateKey: GitHub App private key
  • githubAppID: GitHub Application ID
  • githubAppInstallationID: Installation ID
  • githubAppEnterpriseBaseUrl: Base API URL for GitHub Enterprise
  • tlsClientCertData: TLS client certificate (for custom certs)
  • tlsClientCertKey: TLS client certificate private key

Best Practices

Use Sealed Secrets

Consider using sealed-secrets to store encrypted Secret definitions as Kubernetes manifests.

Scope Credentials

Use the project field to limit repository credentials to specific Argo CD projects.

Credential Templates

Leverage credential templates to avoid duplicating credentials across multiple repositories.

Manage Certificates

Keep TLS certificates and SSH known hosts up to date in their respective ConfigMaps.