Skip to main content
The Argo CD CLI (argocd) provides a complete interface for managing your GitOps deployments. This page covers authentication, configuration, and common usage patterns.

Global Flags

The CLI supports numerous global flags that apply to all commands:
argocd [command] [flags]

Authentication Flags

--server
string
Argo CD server address
--auth-token
string
Authentication token (or set ARGOCD_AUTH_TOKEN environment variable)
--argocd-context
string
The name of the Argo CD server context to use

Connection Flags

--insecure
boolean
Skip server certificate and domain verification
--plaintext
boolean
Disable TLS
--grpc-web
boolean
Enables gRPC-web protocol. Useful if Argo CD server is behind proxy which does not support HTTP2
--port-forward
boolean
Connect to a random argocd-server port using port forwarding
--port-forward-namespace
string
Namespace name which should be used for port forwarding

Kubernetes Flags

--core
boolean
If set to true, CLI talks directly to Kubernetes instead of Argo CD API server
--kube-context
string
Directs the command to the given kube-context

Authentication

Login to Argo CD Server

Authenticate with username and password:
argocd login cd.example.com
You’ll be prompted for credentials:
WARNING: server certificate had error: x509: certificate signed by unknown authority. Proceed insecurely (y/n)? y
Username: admin
Password: 
'admin:login' logged in successfully
Context 'cd.example.com' updated

SSO Login

Login using Single Sign-On:
argocd login cd.example.com --sso
This will open your browser for SSO authentication.

Skip TLS Verification

For testing or self-signed certificates:
argocd login cd.example.com --insecure
Using --insecure is not recommended for production environments as it skips certificate verification.

Using Authentication Tokens

Generate and use an authentication token:
# Generate a token
argocd account generate-token --account admin

# Use the token
argocd app list --auth-token <your-token> --server cd.example.com

# Or set it as an environment variable
export ARGOCD_AUTH_TOKEN=<your-token>
argocd app list --server cd.example.com

Core Mode (Direct Kubernetes Access)

For administrative tasks without going through the API server:
argocd login cd.example.com --core

Configuration File

The CLI stores configuration in ~/.config/argocd/config (or $HOME/.argocd/config on older versions):
contexts:
- name: cd.example.com
  server: cd.example.com
  user: admin
current-context: cd.example.com
users:
- auth-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
  name: admin
  refresh-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Manage Contexts

Switch between multiple Argo CD servers:
# List available contexts
argocd context

# Switch context
argocd context cd.example.com

Common Usage Patterns

Quick Application Status

# List all applications
argocd app list

# Get specific application
argocd app get my-app

# Watch application sync status
argocd app wait my-app --health

Sync and Deploy

# Sync an application
argocd app sync my-app

# Sync with preview
argocd app diff my-app
argocd app sync my-app

# Force sync (override protections)
argocd app sync my-app --force

Multiple Output Formats

Most commands support different output formats:
# JSON output
argocd app list -o json

# YAML output
argocd app get my-app -o yaml

# Wide format (more details)
argocd cluster list -o wide

Port Forwarding

Access Argo CD without external exposure:
# Use port forwarding for all commands
argocd app list --port-forward --port-forward-namespace argocd

# Or configure it in your context
argocd login --port-forward --port-forward-namespace argocd

Shell Completion

Enable shell completion for faster command entry:
# Add to ~/.bashrc
source <(argocd completion bash)

# Or install globally
argocd completion bash > /etc/bash_completion.d/argocd

Troubleshooting

Connection Issues

# Test connection
argocd version

# Enable debug logging
argocd app list --loglevel debug

# Skip TLS verification (temporary)
argocd app list --insecure

Authentication Expiry

If your token expires:
# Re-login
argocd relogin

# Or login again
argocd login cd.example.com

Available Commands

app

Manage applications

appset

Manage ApplicationSets

cluster

Manage cluster credentials

repo

Manage repository connections

project

Manage projects

admin

Administrative commands

account

Manage account settings

Environment Variables

ARGOCD_AUTH_TOKEN
string
Authentication token to avoid passing --auth-token flag
ARGOCD_SERVER
string
Argo CD server address to avoid passing --server flag
ARGOCD_OPTS
string
Additional CLI options applied to all commands

Next Steps

App Commands

Learn application management commands

Cluster Commands

Configure cluster connections