Harness CLI serves as your gateway to frictionless interaction with the intelligent Harness Platform directly through the command-line interface, providing you with a powerful and efficient means to manage Harness and its diverse set of resources.
This documentation section will serve as your compass, guiding you through the installation, configuration, and upgrade of the Harness CLI utility.
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.16-Preview/harness-v0.0.16-Preview-linux-arm64.tar.gz
tar -xvf harness-v0.0.16-Preview-linux-arm64.tar.gz
curl -LO https://github.com/harness/harness-cli/releases/download/v0.0.16-Preview/harness-v0.0.16-Preview-linux-amd64.tar.gz
tar -xvf harness-v0.0.16-Preview-linux-amd64.tar.gz
- Add the binary path to the system
echo 'export PATH="$(pwd):$PATH"' >> ~/.bash_profile
- After you install the CLI, it is available using the
harnesscommand. To verify run:
Install the CLI on MacOS
- Run commands below on terminal
curl -LO https://github.com/harness/harness-cli/releases/download/v0.0.16-Preview/harness-v0.0.16-Preview-darwin-amd64.tar.gz
tar -xvf harness-v0.0.16-Preview-darwin-amd64.tar.gz
echo 'export PATH="'$(pwd)':$PATH"' >> ~/.bash_profile
(If you are using different shell variation of terminal e.g. zsh, replace
~/.bash_profile with your shell specific profile file path e.g.
Install the CLI on Windows
- Run the commands below in Windows Powershell:
Invoke-WebRequest -Uri https://github.com/harness/harness-cli/releases/download/v0.0.16-Preview/harness-v0.0.16-Preview-windows-amd64.zip -OutFile ./harness.zip
- Extract the downloaded zip file and change directory to extracted file location
- Run following command in powershell to setup environment variables:
[Environment]::SetEnvironmentVariable("PATH", "$env:PATH;$currentPath", [EnvironmentVariableTarget]::Machine)
- Restart terminal
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.
Account IDby navigating within the
Login to Harness from CLI.
harness login --api-key HARNESS_API_TOKEN --account-id HARNESS_ACCOUNT_ID
HARNESS_API_TOKENwith the Harness API Token obtained in the previous step, and
HARNESS_ACCOUNT_IDwith your specific Account Id.
- Upon successful login, you will be greeted with the confirmation message Login successfully done. Yay!.