Skip to content
LatchkeyLatchkey home

argocd repo add: Register a Git Repository

argocd repo add registers a Git repository and its credentials so Applications can source manifests from it.

Private repos must be added with credentials before any Application can use them. The CLI supports HTTPS token auth and SSH keys.

What it does

argocd repo add stores a repository URL plus credentials in Argo CD. For HTTPS, pass --username and --password (a PAT). For SSH, pass --ssh-private-key-path. The credential is reused by any Application whose --repo matches.

Common usage

Terminal
# HTTPS with a personal access token
argocd repo add https://github.com/acme/manifests.git \
  --username git --password "$GITHUB_TOKEN"
# SSH
argocd repo add git@github.com:acme/manifests.git \
  --ssh-private-key-path ./deploy_key

Options

FlagWhat it does
--username / --passwordHTTPS credentials (use a token as password)
--ssh-private-key-path <file>SSH key for git@ URLs
--insecure-skip-server-verificationSkip SSH host key verification
--type git|helmRepository type (git default; helm for chart repos)
--name <name>Friendly name (required for some helm repos)

Common errors in CI

"FATA[0000] rpc error: code = Unknown desc = authentication required" means missing or wrong credentials for a private repo. "ssh: handshake failed: knownhosts: key is unknown" means the host key is not trusted; add it to the repo-server known hosts or pass --insecure-skip-server-verification for tests. The repo URL in repo add must match the Application --repo exactly, including the .git suffix.

Using this in CI

A runner has no kubeconfig, no cached context, and no interactive auth. Every kubectl invocation in CI needs the context supplied explicitly, and most confusing CI failures here are the command running against the wrong cluster or no cluster at all.

Terminal
# never rely on the ambient context on a runner
kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pods

# confirm what you are actually connected to before mutating anything
kubectl config current-context
kubectl cluster-info

# fail fast instead of hanging on an unreachable API server
kubectl --request-timeout=30s get nodes

Frequently asked questions

argocd repo add: Register a Git Repository?
Private repos must be added with credentials before any Application can use them. The CLI supports HTTPS token auth and SSH keys.
What it does?
argocd repo add stores a repository URL plus credentials in Argo CD. For HTTPS, pass --username and --password (a PAT). For SSH, pass --ssh-private-key-path. The credential is reused by any Application whose --repo matches.
Common errors in CI?
"FATA[0000] rpc error: code = Unknown desc = authentication required" means missing or wrong credentials for a private repo. "ssh: handshake failed: knownhosts: key is unknown" means the host key is not trusted; add it to the repo-server known hosts or pass --insecure-skip-server-verification for tests.

Related guides

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card