Skip to main content
Hero Light

What is Harness CLI?

The Harness CLI (hc) is a unified command-line interface that provides a consistent, resource-based approach to managing your Harness infrastructure. Whether you’re managing artifact registries, deploying infrastructure as code, or automating workflows, hc gives you powerful tools at your fingertips.
The CLI follows a consistent pattern: hc [<global-flags>] <command> <subcommand> [<positional-args>…] [<flags>]

Key features

Artifact Registry management

Create, manage, and migrate artifact registries supporting 12+ package types including Docker, NPM, Maven, and more.

Infrastructure as Code

Plan, apply, and manage your infrastructure deployments directly from the command line.

Multiple output formats

Get results in human-readable tables or JSON format for easy integration with other tools and scripts.

Flexible authentication

Authenticate using interactive login, API keys, environment variables, or configuration files.

Available commands

Manage authentication with Harness services. Login, logout, and check your authentication status.
hc auth login
hc auth status
hc auth logout
Manage Harness Artifact Registries. List, create, configure, and delete registries. Migrate artifacts from external sources.
hc registry list
hc registry get my-registry
hc registry migrate --config migrate.yaml
Manage artifacts within registries. Push, pull, list, and delete artifacts across all supported package types.
hc artifact list --registry my-registry
hc artifact push generic my-registry ./app.zip --name myapp --version 1.0.0
hc artifact pull generic my-registry myapp/1.0.0 ./downloads
Manage infrastructure deployments using Terraform and other IaC tools through Harness.
hc iacm plan --workspace my-workspace

Supported package types

The Harness CLI supports a wide range of package formats:

Docker

Generic

Go

NPM

Maven

Python

NuGet

Cargo

Composer

Conda

Dart

RPM

Quick start

Get up and running with the Harness CLI in minutes:
1

Install the CLI

Use our quick install script to get the latest version:
curl -fsSL https://raw.githubusercontent.com/harness/harness-cli/v2/install | sh
2

Authenticate

Login with your Harness API token:
hc auth login
3

Run your first command

List your registries:
hc registry list

Full quickstart guide

Follow our complete quickstart guide for detailed setup instructions.

Global options

All commands support these global flags for flexible configuration:
--account string    Account ID (overrides saved config)
--api-url string    Base URL for the API (overrides saved config)
--token string      Authentication token (overrides saved config)
--org string        Organisation ID (overrides saved config)
--project string    Project ID (overrides saved config)
--format string     Output format: table (default) or json
--verbose, -v       Enable verbose logging to console
Global flags can be overridden by environment variables (HARNESS_API_URL, HARNESS_API_KEY, etc.) and command-line flags.

Next steps

Installation

Explore all installation methods including manual installation and building from source.

Quickstart guide

Get from zero to your first successful command in minutes.

Authentication concepts

Learn about authentication methods and configuration options.

Command reference

Explore the complete command reference documentation.

Build docs developers (and LLMs) love