Helix TeamHub supports Helix TeamHub CLI for Git and Helix Git repositories.
This section will help you to get started with the Helix TeamHub CLI tool. It covers installation, how to set up the hth-cli tool, and the first few steps required to start performing actions on repositories within your project.
- Helix TeamHub CLI relies on Git for the repository operations. Git must be installed before you install the hth-cli tool. Download Git for your Operating System from https://git-scm.com/downloads.
- Helix TeamHub CLI relies on Helix TeamHub to operate.
- Helix TeamHub CLI uses HTTP(S) and SSH protocols for repository operations. Make sure that you have SSH keys configured for your account, see Configuring SSH keys in the Helix TeamHub User Guide.
To ensure hth-cli compatibility on Windows when running inside Git Bash command prompt prefix hth-cli commands with winpty. For example, winpty hth setup.
- Linux and macOS: hth-cli uses the default editor set in your EDITOR or VISUAL env var settings. If these are not set, hth-cli falls back to using xdg-open for Linux and open for macOS.
- Windows: hth-cli uses the start command to open the file in your default Windows file editor.
- Download the hth-cli binary from the Perforce hth-cli download page.
- Uncompress the downloaded file, this creates a directory with the same name as the download file.
- Set up the hth-cli tool, see Set up the hth-cli tool.
In this section we will create the .hth/cli directory and a global config file by running hth setup without flags. You will be prompted to enter your instance, company, and user details.
The location the .hth/cli directory is created in will depend on the operating system you are using:
- Linux: created in the home directory ~/
- macOS: created in the home directory ~/
- Windows: created in C:\Users\<username>
Run hth setup with flags to specify your instance, company, and user details. You can skip log in with the --no-login flag. For details of the hth setup flags, see Setup hth-cli.
- Set up the hth-cli tool to connect to your Helix TeamHub account and create an active session for the subsequent commands:
- Open your browser and navigate to the project you want to manage from the Helix TeamHub Web UI.
- Create a new repository and in the Advanced Settings, select the Manifest and Generate a default manifest file check boxes.
- Set up your local working directory, see Set up a local working directory.
❯ hth setup
Setting up hth-cli.
Input details of your Helix TeamHub installation.
? Instance URL https://my.helixteamhub.com
? User ID bob
? Password ********
✓ hth-cli is set up for /Users/bob/.hth/cli.
Run hth config edit --global to edit the global configuration file.
You can invalidate the session at any time by using hth logout.
This creates a manifest repository and populates your existing repositories with the required manifest configuration that ties the repositories together.
A local working directory contains a set of repositories within a Helix TeamHub project.
- From the command line, navigate to the path you want to work in and set up your local working directory.
- To clone the manifest repository to your local working directory, run hth init using the clone URL of your manifest repository. To find the clone URL:
- Go to the repository in Helix TeamHub, click the Clone dropdown, and select SSH.
- Copy the clone URL and paste it in when running the hth init command.
- If your project has a manifest file:
- If your project does not have a manifest file:
- Run hth sync to clone all the repositories configured in the manifest file under the current path:
- You are now all set to start using hth-cli, enjoy!
- For information about how and where hth-cli stores its manifest and config files, see Manifest and config files.
- For examples of how to manage your repositories using hth-cli, see the Helix TeamHub CLI examples section on what to do next.
- For information about the hth-cli commands, see Helix TeamHub CLI command reference.
Do one of the following:
❯ hth init git@<GitConnectorURL>.com:hth_cli/manifest Cloning into '/Users/bob/Projects/hth/hth-cli-testing/.hth/cli/manifest'... remote: Counting objects: 4, done. remote: Compressing objects: 100% (3/3), done. remote: Total 4 (delta 0), reused 4 (delta 0) Receiving objects: 100% (4/4), done.
❯ hth init git@<GitConnectorURL>.com:hth_cli
Initializing a local working directory.
✓ Local working directory initialized successfully.
Run hth config edit --local to edit the local configuration file.
Run hth manifest edit to edit the manifest file.
If the hth init command fails, you will see an error message similar the messages below:
✘ Local working directory already exists under /Users/bob/git/hth-cli.
Clean your local working directory before you run hth init again by running the following command in your local working directory:
Linux/macOS: from your local working directory run rm -rf .hth
Windows: from your local working directory run rmdir /S .hth
You can now run the hth init command again.
❯ hth sync ✓ Successfully cloned backend from git@<GitConnectorURL>.com/hth_cli/backend ✓ Successfully cloned frontend from git@<GitConnectorURL>.com/hth_cli/frontend ✓ Successfully cloned docs from git@<GitConnectorURL>.com/hth_cli/docs
Helix TeamHub CLI stores its configuration on two levels:
- Global config: stored in your home directory (Linux and macOS: ~/, Windows: C:\Users\<username>), under .hth/cli. You can change the path to the global config file by setting the HTH_CLI_ROOT environment variable. This directory contains the following files:
- api_keys.json - used to store active sessions (your log in password is never stored)
- config.json - used to store configuration regarding the Helix TeamHub instances, companies and users
- Local config: stored in your local working directory, under .hth/cli. This directory contains the following files:
- config.json - contains local overrides for the global config.json configuration
- manifest - the manifest repository for the local working directory