Documentation Index
Fetch the complete documentation index at: https://mintlify.com/harness/harness-cli/llms.txt
Use this file to discover all available pages before exploring further.
General Questions
What is Harness CLI (hc)?
What is Harness CLI (hc)?
Which Harness services does the CLI support?
Which Harness services does the CLI support?
- Authentication: Login, logout, and session management
- Artifact Registry (AR): Manage registries and artifacts
- Infrastructure as Code Management (IaCM): Terraform operations
- Projects and Organizations: Resource management (coming soon)
- API Passthrough: Direct REST API access for power users (coming soon)
What platforms are supported?
What platforms are supported?
- Linux: x86_64, ARM64
- macOS: Intel and Apple Silicon (M1/M2)
- Windows: x86_64
Is the CLI open source?
Is the CLI open source?
- View the source code on GitHub
- Contribute improvements and bug fixes
- Report issues and request features
Installation and Setup
How do I install the CLI?
How do I install the CLI?
- Download binary from releases page
- Build from source:
make build - Custom installation directory:
Where does the CLI store configuration?
Where does the CLI store configuration?
- API base URL
- Authentication token
- Account ID
- Default organization and project (optional)
Can I use multiple accounts or profiles?
Can I use multiple accounts or profiles?
- Use different tokens via command-line flags:
- Maintain multiple configuration files and swap them manually
Do I need to authenticate for every command?
Do I need to authenticate for every command?
hc auth login, your credentials are saved and automatically used for subsequent commands.You only need to re-authenticate if:- Your token expires
- You logout explicitly
- You switch accounts
- You want to override saved credentials with command-line flags
Authentication
How do I generate an API token?
How do I generate an API token?
- Log into the Harness platform (https://app.harness.io)
- Navigate to your profile settings
- Go to “API Keys” or “Personal Access Tokens”
- Click “Create Token” or “New API Key”
- Give it a name and select appropriate scopes
- Copy the generated token (you won’t see it again)
What token format does the CLI expect?
What token format does the CLI expect?
Can I use environment variables for authentication?
Can I use environment variables for authentication?
- Save credentials via
hc auth login(recommended) - Use command-line flags:
- Script token passing:
How do I check my current authentication status?
How do I check my current authentication status?
- Current authentication state
- API URL
- Account ID
- Organization ID (if set)
- Project ID (if set)
Usage
What is the general command structure?
What is the general command structure?
How do I view command help?
How do I view command help?
--help or -h to any command:Can I output results in JSON format?
Can I output results in JSON format?
--format flag:- Scripting and automation
- Parsing with tools like
jq - Integration with other systems
table for human-readable output.How do I specify organization and project scope?
How do I specify organization and project scope?
Can I use command aliases?
Can I use command aliases?
hc reg=hc registryhc art=hc artifacthc proj=hc projecthc org=hc organisation
Artifact Registry
What package types are supported?
What package types are supported?
- Docker / OCI containers
- Generic (any file type)
- Go modules
- npm (Node.js)
- Maven (Java)
- Python (PyPI)
- NuGet (.NET)
- Cargo (Rust)
- Composer (PHP)
- Conda (Python/R)
- Dart (Pub)
- RPM (Red Hat)
How do I push artifacts to a registry?
How do I push artifacts to a registry?
artifact push command with the appropriate package type:Can I migrate artifacts from other registries?
Can I migrate artifacts from other registries?
- JFrog Artifactory
- Sonatype Nexus
- Other registries
How do I delete artifacts or versions?
How do I delete artifacts or versions?
Can I configure my local package manager to use Harness registries?
Can I configure my local package manager to use Harness registries?
Troubleshooting
How do I enable debug logging?
How do I enable debug logging?
--log-file flag to save detailed logs:- API requests and responses
- Error details
- Timing information
Why am I getting authentication errors?
Why am I getting authentication errors?
- Token expired - Re-authenticate with
hc auth login - Invalid token - Verify token in Harness platform
- Insufficient permissions - Check token scopes
- Wrong account/org/project - Verify with
hc auth status
Commands are timing out or very slow
Commands are timing out or very slow
- Network connectivity issues
- Large artifact transfers
- High migration concurrency
- Check network connection to Harness endpoints
- Reduce migration concurrency:
- Split large operations into smaller batches
Where can I get help?
Where can I get help?
- Documentation: Full guides and reference at this site
- GitHub Issues: Report bugs
- Community: Join Harness community discussions
- Troubleshooting Guide: Common issues and solutions
Development and Contributing
How can I contribute to the CLI?
How can I contribute to the CLI?
- Fork the repository on GitHub
- Create a feature branch
- Make your changes
- Run tests:
make test - Submit a pull request
How do I build the CLI from source?
How do I build the CLI from source?
- Go 1.21 or later
- Make
./hc.How do I run tests?
How do I run tests?
What is the project structure?
What is the project structure?