# argocd repo add: Register a Git Repository

> argocd repo add registers a Git repo with Argo CD, with HTTPS or SSH credentials. Reference for --username, --ssh-private-key-path, and the auth errors in CI.

Source: https://latchkey.dev/learn/command-reference/argocd-repo-add  
Updated: 2026-06-30

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

| Flag | What it does |
| --- | --- |
| --username / --password | HTTPS credentials (use a token as password) |
| --ssh-private-key-path <file> | SSH key for git@ URLs |
| --insecure-skip-server-verification | Skip SSH host key verification |
| --type git|helm | Repository 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
```

> Always set `--request-timeout` in CI. Without it an unreachable API server hangs until the job times out, which turns a thirty-second failure into a twenty-minute one.

## FAQ

### 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.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
