Overview
Argo CD repository credentials are stored in Kubernetes Secrets with the labelargocd.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
urlfield containing the repository URL - Authentication credentials (varies by connection type)
- Optional
projectfield 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:SSH Repositories
Connect using SSH private keys: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 theargocd-tls-certs-cm ConfigMap:
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 theargocd-ssh-known-hosts-cm ConfigMap:
ssh-keyscan:
Credential Fields Reference
SSH Repositories
sshPrivateKey: SSH private key for authentication
HTTPS Repositories
username: Username for authenticationpassword: Password for authenticationtlsClientCertData: TLS client certificatetlsClientCertKey: TLS client certificate private key
GitHub App Repositories
githubAppPrivateKey: GitHub App private keygithubAppID: GitHub Application IDgithubAppInstallationID: Installation IDgithubAppEnterpriseBaseUrl: Base API URL for GitHub EnterprisetlsClientCertData: 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.