> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/argoproj/argo-cd/llms.txt
> Use this file to discover all available pages before exploring further.

# argocd repo

> Manage repository connection parameters for Git, Helm, and OCI repositories

The `argocd repo` command manages repository connections, allowing Argo CD to access Git repositories, Helm charts, and OCI registries.

## Quick Examples

```bash theme={null}
# Add a Git repository
argocd repo add git@git.example.com:repos/repo

# Get repository details
argocd repo get https://github.com/yourusername/your-repo.git

# List all repositories
argocd repo list

# Remove a repository
argocd repo rm https://github.com/yourusername/your-repo.git
```

## Subcommands

### add

Add Git, Helm, or OCI repository connection parameters.

<Tabs>
  <Tab title="Git via SSH">
    Add a private Git repository using SSH:

    ```bash theme={null}
    # With SSH key
    argocd repo add git@github.com:myorg/myrepo.git \
      --ssh-private-key-path ~/.ssh/id_rsa

    # Ignore host key checking (not recommended for production)
    argocd repo add git@git.example.com:repos/repo \
      --insecure-ignore-host-key \
      --ssh-private-key-path ~/id_rsa

    # Non-standard SSH port
    argocd repo add ssh://git@git.example.com:2222/repos/repo \
      --ssh-private-key-path ~/id_rsa
    ```
  </Tab>

  <Tab title="Git via HTTPS">
    Add a private Git repository using HTTPS:

    ```bash theme={null}
    # With username and password
    argocd repo add https://github.com/myorg/myrepo.git \
      --username git \
      --password ghp_xxxxxxxxxxxx

    # With TLS client certificates
    argocd repo add https://git.example.com/repos/repo \
      --username git \
      --password secret \
      --tls-client-cert-path ~/mycert.crt \
      --tls-client-cert-key-path ~/mycert.key

    # Skip TLS verification (not recommended)
    argocd repo add https://git.example.com/repos/repo \
      --username git \
      --password secret \
      --insecure-skip-server-verification
    ```
  </Tab>

  <Tab title="Helm Repository">
    Add a Helm chart repository:

    ```bash theme={null}
    # Public Helm repository
    argocd repo add https://charts.helm.sh/stable \
      --type helm \
      --name stable

    # Private Helm repository
    argocd repo add https://charts.example.com \
      --type helm \
      --name private-charts \
      --username admin \
      --password secret

    # Helm OCI registry
    argocd repo add helm-oci-registry.example.com \
      --type helm \
      --name oci-charts \
      --enable-oci \
      --username myuser \
      --password mypass
    ```
  </Tab>

  <Tab title="OCI Registry">
    Add an OCI registry:

    ```bash theme={null}
    # HTTPS OCI repository
    argocd repo add oci://registry.example.com \
      --type oci \
      --name my-oci-repo \
      --username myuser \
      --password mypass

    # Skip TLS verification
    argocd repo add oci://registry.example.com \
      --type oci \
      --name my-oci-repo \
      --username myuser \
      --password mypass \
      --insecure-skip-server-verification

    # Force HTTP (insecure)
    argocd repo add oci://registry.example.com \
      --type oci \
      --name my-oci-repo \
      --username myuser \
      --password mypass \
      --insecure-oci-force-http
    ```
  </Tab>
</Tabs>

**Key Flags:**

<ParamField path="--type" type="string" default="git">
  Repository type: `git`, `helm`, or `oci`
</ParamField>

<ParamField path="--name" type="string">
  Repository name (required for Helm repositories)
</ParamField>

<ParamField path="--username" type="string">
  Username for authentication
</ParamField>

<ParamField path="--password" type="string">
  Password for authentication
</ParamField>

<ParamField path="--ssh-private-key-path" type="string">
  Path to SSH private key file
</ParamField>

<ParamField path="--tls-client-cert-path" type="string">
  Path to TLS client certificate (PEM format)
</ParamField>

<ParamField path="--tls-client-cert-key-path" type="string">
  Path to TLS client certificate key (PEM format)
</ParamField>

<ParamField path="--insecure-skip-server-verification" type="boolean">
  Disable server certificate and host key checks
</ParamField>

<ParamField path="--upsert" type="boolean">
  Update repository if it already exists
</ParamField>

<ParamField path="--project" type="string">
  Restrict repository to specific project
</ParamField>

### Advanced Authentication Options

#### GitHub App

Authenticate using GitHub App:

```bash theme={null}
# GitHub.com
argocd repo add https://github.com/myorg/myrepo.git \
  --github-app-id 12345 \
  --github-app-installation-id 67890 \
  --github-app-private-key-path app-private-key.pem

# GitHub Enterprise
argocd repo add https://ghe.example.com/myorg/myrepo.git \
  --github-app-id 12345 \
  --github-app-installation-id 67890 \
  --github-app-private-key-path app-private-key.pem \
  --github-app-enterprise-base-url https://ghe.example.com/api/v3
```

<ParamField path="--github-app-id" type="integer">
  GitHub Application ID
</ParamField>

<ParamField path="--github-app-installation-id" type="integer">
  GitHub App installation ID (optional, auto-discovered if not provided)
</ParamField>

<ParamField path="--github-app-private-key-path" type="string">
  Path to GitHub App private key file
</ParamField>

<ParamField path="--github-app-enterprise-base-url" type="string">
  Base URL for GitHub Enterprise API
</ParamField>

#### Google Cloud Source

Authenticate with GCP service account:

```bash theme={null}
argocd repo add https://source.developers.google.com/p/my-project/r/my-repo \
  --gcp-service-account-key-path service-account-key.json
```

#### Proxy Configuration

Add repository with proxy support:

```bash theme={null}
# With SOCKS5 proxy (no auth)
argocd repo add ssh://git@github.com/argoproj/argocd-example-apps \
  --ssh-private-key-path ~/id_rsa \
  --proxy socks5://proxy.example.com:1080

# With SOCKS5 proxy (with auth)
argocd repo add ssh://git@github.com/argoproj/argocd-example-apps \
  --ssh-private-key-path ~/id_rsa \
  --proxy socks5://username:password@proxy.example.com:1080
```

#### Git LFS

Enable Git Large File Storage:

```bash theme={null}
argocd repo add https://github.com/myorg/large-files-repo.git \
  --username git \
  --password token \
  --enable-lfs
```

### list

List all configured repositories.

```bash theme={null}
# List repositories
argocd repo list

# List with refresh status
argocd repo list --refresh

# List as JSON
argocd repo list -o json

# List as YAML
argocd repo list -o yaml
```

**Output:**

```
TYPE  NAME                REPO                                          INSECURE  OCI    LFS    CREDS  STATUS      MESSAGE  PROJECT
git                       https://github.com/argoproj/argocd-example-apps.git  false     false  false  false  Successful           default
git                       git@github.com:myorg/private-repo.git                 false     false  false  true   Successful           default
helm  stable              https://charts.helm.sh/stable                         false     false  false  false  Successful           default
helm  my-charts           https://charts.example.com                            false     false  false  true   Successful           my-project
oci   oci-registry        oci://registry.example.com                            false     true   false  true   Successful           default
```

### get

Get details about a configured repository.

```bash theme={null}
# Get repository by URL
argocd repo get https://github.com/myorg/myrepo.git

# Get with output format
argocd repo get https://github.com/myorg/myrepo.git -o yaml

# Refresh connection status
argocd repo get https://github.com/myorg/myrepo.git --refresh
```

**Output:**

```
Repository:
  URL:                  https://github.com/argoproj/argocd-example-apps.git
  Type:                 git
  Connection Status:    Successful
  Message:              
Info:
  Last Checked:         2024-01-15 14:30:45 +0000 UTC
  Connection State:     Successful
```

### rm

Remove a repository configuration.

```bash theme={null}
# Remove repository
argocd repo rm https://github.com/myorg/myrepo.git

# Remove without confirmation
argocd repo rm https://github.com/myorg/myrepo.git --yes
```

<Warning>
  Removing a repository does not delete applications using it, but they will no longer be able to sync.
</Warning>

## Repository Credentials (repocreds)

For managing credential templates that apply to multiple repositories, use `argocd repocreds`:

### Add Credential Template

```bash theme={null}
# Git credentials for all repos under a URL
argocd repocreds add https://github.com/myorg \
  --username git \
  --password ghp_xxxxxxxxxxxx

# SSH credentials
argocd repocreds add git@github.com:myorg \
  --ssh-private-key-path ~/.ssh/id_rsa

# TLS credentials
argocd repocreds add https://git.example.com \
  --tls-client-cert-path ~/cert.pem \
  --tls-client-cert-key-path ~/key.pem
```

### List Credential Templates

```bash theme={null}
# List all credential templates
argocd repocreds list

# List as JSON
argocd repocreds list -o json
```

### Remove Credential Template

```bash theme={null}
argocd repocreds rm https://github.com/myorg
```

## Common Workflows

### Adding GitHub Private Repository

```bash theme={null}
# Using Personal Access Token
argocd repo add https://github.com/myorg/private-repo.git \
  --username git \
  --password ghp_YourPersonalAccessTokenHere

# Using SSH
argocd repo add git@github.com:myorg/private-repo.git \
  --ssh-private-key-path ~/.ssh/github_deploy_key

# Using GitHub App (recommended for organizations)
argocd repo add https://github.com/myorg/private-repo.git \
  --github-app-id 123456 \
  --github-app-installation-id 789012 \
  --github-app-private-key-path github-app.pem
```

### Adding GitLab Private Repository

```bash theme={null}
# Using Deploy Token
argocd repo add https://gitlab.com/myorg/myrepo.git \
  --username gitlab-deploy-token \
  --password gldt-xxxxxxxxxxxx

# Using SSH
argocd repo add git@gitlab.com:myorg/myrepo.git \
  --ssh-private-key-path ~/.ssh/gitlab_deploy_key
```

### Adding Azure DevOps Repository

```bash theme={null}
# Using Personal Access Token
argocd repo add https://dev.azure.com/myorg/myproject/_git/myrepo \
  --username anystring \
  --password your-pat-token
```

### Adding Bitbucket Repository

```bash theme={null}
# Using App Password
argocd repo add https://bitbucket.org/myorg/myrepo.git \
  --username myusername \
  --password app-password

# Using SSH
argocd repo add git@bitbucket.org:myorg/myrepo.git \
  --ssh-private-key-path ~/.ssh/bitbucket_key
```

### Managing Multiple Repositories

Use credential templates for efficiency:

```bash theme={null}
# Add credential template for organization
argocd repocreds add https://github.com/myorg \
  --username git \
  --password ghp_xxxxxxxxxxxx

# Now add repositories without specifying credentials
argocd repo add https://github.com/myorg/repo1.git
argocd repo add https://github.com/myorg/repo2.git
argocd repo add https://github.com/myorg/repo3.git
```

### Helm Chart Repositories

```bash theme={null}
# Popular public Helm repos
argocd repo add https://charts.bitnami.com/bitnami --type helm --name bitnami
argocd repo add https://kubernetes.github.io/ingress-nginx --type helm --name ingress-nginx
argocd repo add https://prometheus-community.github.io/helm-charts --type helm --name prometheus

# Private Helm repo with basic auth
argocd repo add https://charts.mycompany.com \
  --type helm \
  --name company-charts \
  --username admin \
  --password secret123
```

### OCI Registries

```bash theme={null}
# Docker Hub
argocd repo add oci://registry.hub.docker.com \
  --type oci \
  --name dockerhub \
  --username myusername \
  --password mydockerhubtoken

# AWS ECR
argocd repo add oci://123456789.dkr.ecr.us-west-2.amazonaws.com \
  --type oci \
  --name ecr \
  --username AWS \
  --password $(aws ecr get-login-password --region us-west-2)

# Google Artifact Registry
argocd repo add oci://us-docker.pkg.dev/my-project/my-repo \
  --type oci \
  --name gar \
  --username _json_key \
  --password "$(cat service-account-key.json)"
```

## Troubleshooting

### Test Repository Connection

```bash theme={null}
# Check repository status
argocd repo get https://github.com/myorg/myrepo.git

# Force refresh connection
argocd repo get https://github.com/myorg/myrepo.git --refresh

# List all repos with status
argocd repo list --refresh
```

### Authentication Failures

```bash theme={null}
# For HTTPS: verify credentials
curl -u username:password https://github.com/myorg/myrepo.git/info/refs?service=git-upload-pack

# For SSH: test SSH connection
ssh -T git@github.com -i ~/.ssh/deploy_key

# Update credentials
argocd repo add https://github.com/myorg/myrepo.git \
  --username git \
  --password new-token \
  --upsert
```

### Certificate Issues

```bash theme={null}
# Temporarily skip verification (not for production)
argocd repo add https://git.example.com/repo.git \
  --username git \
  --password token \
  --insecure-skip-server-verification

# Or add proper certificates
argocd repo add https://git.example.com/repo.git \
  --username git \
  --password token \
  --tls-client-cert-path /path/to/cert.pem \
  --tls-client-cert-key-path /path/to/key.pem
```

### SSH Key Issues

```bash theme={null}
# Verify SSH key permissions
chmod 600 ~/.ssh/deploy_key

# Test SSH connection
ssh -i ~/.ssh/deploy_key git@github.com

# Add with correct key
argocd repo add git@github.com:myorg/myrepo.git \
  --ssh-private-key-path ~/.ssh/deploy_key
```

## Security Best Practices

<Note>
  * Use deploy keys or tokens with minimal required permissions
  * For GitHub, use GitHub Apps instead of personal access tokens
  * Rotate credentials regularly
  * Use credential templates (repocreds) to avoid duplicating secrets
  * Never commit credentials to Git repositories
  * Use secrets management systems (Vault, etc.) where possible
  * Enable Git LFS only when needed to avoid performance issues
  * Use TLS certificates for private Git servers
</Note>

## Environment Variables

Repository credentials can also be configured via environment variables:

```bash theme={null}
export ARGOCD_REPO_URL="https://github.com/myorg/myrepo.git"
export ARGOCD_REPO_USERNAME="git"
export ARGOCD_REPO_PASSWORD="ghp_token"

argocd repo add $ARGOCD_REPO_URL --username $ARGOCD_REPO_USERNAME --password $ARGOCD_REPO_PASSWORD
```

## Next Steps

<CardGroup cols={2}>
  <Card title="App Commands" icon="rocket" href="/cli/app">
    Create applications from repositories
  </Card>

  <Card title="Project Commands" icon="folder" href="/cli/project">
    Organize repositories by project
  </Card>
</CardGroup>
