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
Available Commands:
gh extension create
gh extension install {
gh extension list [--json]
gh extension remove
gh extension upgrade {--all |
gh extension [--help]
PARAMETERS
-h, --help
Displays help information for the `gh extension` command or its specific subcommands.
--pin
Used with `install`. Specifies a particular Git version, tag, or branch to pin the extension to during installation. For example, `gh extension install owner/repo --pin v1.2.3`.
--force
Used with `install`. Forces the installation, overwriting any existing extension with the same name without prompting for confirmation.
--all
Used with `upgrade`. Upgrades all currently installed extensions to their latest available versions in one go.
--json
Used with `list`. Outputs the list of installed extensions in machine-readable JSON format, which is useful for scripting and programmatic access.
DESCRIPTION
The `gh-extension` command is a vital component of the GitHub CLI (`gh`), specifically designed for managing custom extensions. These extensions empower users to enhance and personalize their `gh` command-line experience by integrating new commands or automating complex workflows.
Through `gh-extension`, users gain a comprehensive toolkit to interact with the extension ecosystem. It allows for the effortless installation of extensions directly from GitHub repositories, providing a streamlined way to expand functionality. Users can easily list all currently installed extensions to keep track of their setup, remove any unwanted or outdated extensions, and upgrade existing ones to their latest versions, ensuring they benefit from new features and bug fixes.
Additionally, `gh-extension` offers capabilities to create new extensions, fostering a community-driven approach where developers can build and share their own custom commands. This command plays a pivotal role in extending the GitHub CLI's capabilities far beyond its core features, cultivating a dynamic, adaptable, and highly personalized command-line environment for GitHub users.
CAVEATS
Security Risk: Extensions run arbitrary code on your system. It is crucial to only install extensions from trusted sources to avoid potential security vulnerabilities or malicious scripts.
Compatibility: While generally robust, extensions might occasionally encounter compatibility issues with major updates to the `gh` CLI or changes in the GitHub API, requiring updates from the extension's maintainer.
EXTENSION TYPES AND NAMING
GitHub CLI extensions can be implemented as shell scripts (e.g., Bash, PowerShell) or compiled binaries. They must be executable and follow a specific naming convention: `gh-
INSTALLATION SOURCES
Extensions are typically installed directly from GitHub repositories using the `owner/repo` syntax. The GitHub CLI automatically detects and installs the appropriate executable or script from the specified repository, making the installation process seamless for users.
HISTORY
The GitHub CLI (`gh`) emerged as a powerful tool for interacting with GitHub from the command line, reaching general availability in 2020. The `gh-extension` mechanism was introduced as a core feature early in its development, reflecting a commitment to extensibility and community contribution. This design choice enabled users and developers to build and share custom commands, significantly expanding the CLI's native capabilities and fostering a highly modular ecosystem around the GitHub CLI.