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
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.gzcurl -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.gzAdd the binary path to the system
$PATHvariable
echo 'export PATH="$(pwd):$PATH"' >> ~/.bash_profile
source ~/.bash_profileAfter you install the CLI, it is available using the
harnesscommand. To verify run:
harness --versionInstall the CLI on MacOS
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)
Configure Harness CLI
Obtain Harness API Token. You can follow the steps outlined in the Harness documentation's guide on how to create a personal API token.
Retrieve your
Account IDby navigating within theHarness UItoACCOUNT SETTINGS>Overview>Account Id.Login to Harness from CLI.
harness login --api-key HARNESS_API_TOKEN --account-id HARNESS_ACCOUNT_IDNote: Replace
HARNESS_API_TOKENwith the Harness API Token obtained in the previous step, andHARNESS_ACCOUNT_IDwith your specific Account Id.Upon successful login, you will be greeted with the confirmation message Login successfully done. Yay!

Last updated
Was this helpful?