Skip to content
Latchkey

gh extension install: Add gh Extensions in CI

gh extension install adds a gh CLI extension from a repository, extending gh with new subcommands.

Workflows that depend on a community gh extension install it as a setup step, ideally pinned to a release for reproducibility.

What it does

gh extension install adds an extension hosted in a GitHub repository, making its gh-prefixed commands available as gh subcommands. --pin locks the extension to a specific tag or commit so the version is reproducible.

Common usage

Terminal
gh extension install owner/gh-myext
gh extension install owner/gh-myext --pin v1.4.0
gh extension list
gh extension install .

Flags

FlagWhat it does
<owner/repo>Extension repository to install
--pin <tag|sha>Pin to a specific release tag or commit
--forceForce a (re)install
.Install the extension in the current directory

In CI

Set GH_TOKEN so installs from private extension repos authenticate. Always --pin a version in CI; tracking the default branch makes builds non-reproducible. Run gh extension list to confirm the install, and remember the extension binary must support the runner OS and architecture.

Common errors in CI

"there is already an installed extension that provides the X command" means it is installed; use --force or skip. "gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable" appears when a private extension repo needs auth. "X is not a gh extension" means the repo is missing a gh-X executable.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →