For the complete documentation index, see llms.txt. This page is also available as Markdown.

V0

Install Harness CLI

You can install harness CLI utility on Linux, MacOS, or Windows in order to interact with Harness Platform from a command-line interface.

Install the CLI on Linux

  1. Download and extract the Harness CLI binary.

curl -LO https://github.com/harness/harness-cli/releases/download/v0.0.25-Preview/harness-v0.0.25-Preview-linux-arm64.tar.gz
tar -xvf harness-v0.0.25-Preview-linux-arm64.tar.gz
curl -LO https://github.com/harness/harness-cli/releases/download/v0.0.25-Preview/harness-v0.0.25-Preview-linux-amd64.tar.gz
tar -xvf harness-v0.0.25-Preview-linux-amd64.tar.gz
  1. Add the binary path to the system $PATH variable

echo 'export PATH="$(pwd):$PATH"' >> ~/.bash_profile
source ~/.bash_profile
  1. After you install the CLI, it is available using the harness command. To verify run:

harness --version

Install the CLI on MacOS

  1. Run commands below on terminal

curl -LO https://github.com/harness/harness-cli/releases/download/v0.0.25-Preview/harness-v0.0.25-Preview-darwin-amd64.tar.gz
tar -xvf harness-v0.0.25-Preview-darwin-amd64.tar.gz 
export PATH="$(pwd):$PATH" 
echo 'export PATH="'$(pwd)':$PATH"' >> ~/.bash_profile  
source ~/.bash_profile 
harness --version

(If you are using different shell variation of terminal e.g. zsh, replace ~/.bash_profile with your shell specific profile file path e.g. ~/.zshrc)

Install the CLI on Windows

  1. Run the commands below in Windows Powershell:

  1. Extract the downloaded zip file and change directory to extracted file location

  2. Run following command in powershell to setup environment variables:

  1. Restart terminal

Configure Harness CLI

  1. Obtain Harness API Token. You can follow the steps outlined in the Harness documentation's guide on how to create a personal API token.

  2. Retrieve your Account ID by navigating within the Harness UI to ACCOUNT SETTINGS > Overview > Account Id.

  3. Login to Harness from CLI.

    harness login --api-key HARNESS_API_TOKEN --account-id HARNESS_ACCOUNT_ID

    Note: Replace HARNESS_API_TOKEN with the Harness API Token obtained in the previous step, and HARNESS_ACCOUNT_ID with your specific Account Id.

  4. Upon successful login, you will be greeted with the confirmation message Login successfully done. Yay! Harness Login

Last updated

Was this helpful?