gh-extension
Manage GitHub CLI extensions
TLDR
Initialize a new GitHub CLI extension project in a directory of the same name
Install an extension from a GitHub repository
List installed extensions
Upgrade a specific extension
Upgrade all extensions
List installed extensions
Remove an extension
Display help about a subcommand
SYNOPSIS
gh extension <command> [<args>...] [--help]
PARAMETERS
browse [<owner/repo>]
Open extension repository in web browser
install <owner/repo>|<@file>
Install extension from GitHub repo or local file
list [--all|-a]
List installed extensions; --all shows all users' extensions
remove <name> [--all]
Remove named extension; --all removes everything
search <query> [--limit <N>]
Search extensions by keywords; limit results
upgrade [<name>]
Upgrade specific or all installed extensions
--force
Force reinstall/overwrite existing extension (with install)
DESCRIPTION
The gh extension command is part of the GitHub CLI toolset, enabling users to discover, install, manage, and upgrade community-created extensions that extend the core functionality of gh. Extensions are essentially executable scripts or binaries packaged as GitHub repositories, allowing developers to add custom commands, integrations, or workflows directly to the CLI.
Key capabilities include searching the GitHub Marketplace for extensions matching specific queries, browsing extension repositories in the web browser, listing locally installed extensions (including all user-installed ones with --all), installing from a repository URL or local file, removing specific or all extensions, and upgrading them to the latest versions. This modular approach fosters a vibrant ecosystem where users can enhance gh for tasks like advanced PR management, repository insights, or CI/CD integrations without forking the main tool.
Extensions are stored in $XDG_DATA_HOME/gh/extensions (or ~/.local/share/gh/extensions) and must be executable. Upon installation, gh verifies the repository structure, including a CLI.md file for documentation. This command streamlines extensibility, making gh highly customizable for power users and teams.
CAVEATS
Extensions run with user permissions and network access; review source before installing. Not all repos qualify as extensions—must have valid metadata.
EXAMPLES
gh extension install miso715/gh-branch-treasure
gh extension list
gh extension search pr
STORAGE
Extensions in ~/.local/share/gh/extensions/; set GHEXT_PATH env var to override.
HISTORY
Introduced in GitHub CLI v1.0 (Dec 2020); extensions feature evolved to support Marketplace integration by v2.0+, promoting community contributions via cli/cli-extension repo.


