Getting Started with GitHub CLI Extensions

GitHub CLI extensions are custom commands that extend the functionality of gh, the official GitHub CLI tool.

Prerequisites

Before installing extensions, make sure you have GitHub CLI installed:

1# macOS
2brew install gh
3
4# Windows
5winget install GitHub.cli
6
7# Linux (Debian/Ubuntu)
8sudo apt install gh

Then authenticate with GitHub:

1gh auth login

Installing Extensions

Basic Installation

To install an extension, use the gh extension install command:

1gh extension install owner/repo

For example, to install the popular gh-dash extension:

1gh extension install dlvhdr/gh-dash

From GitHub URL

You can also install directly from a GitHub URL:

1gh extension install https://github.com/dlvhdr/gh-dash

Managing Extensions

List Installed Extensions

1gh extension list

Update Extensions

Update a specific extension:

1gh extension upgrade owner/repo

Update all extensions:

1gh extension upgrade --all

Remove Extensions

1gh extension remove owner/repo

Using Extensions

Once installed, extensions are available as gh subcommands:

1# If you installed gh-dash
2gh dash
3
4# If you installed gh-poi
5gh poi

Here are some highly recommended extensions to get started:

Extension Description
dlvhdr/gh-dash A beautiful dashboard for PRs and issues
seachicken/gh-poi Safely clean up local branches
github/gh-copilot GitHub Copilot in your terminal
vilmibm/gh-screensaver Fun terminal screensavers

Creating Your Own Extension

Want to create your own extension? Check out the official documentation.

1# Create a new extension
2gh extension create my-extension
3
4# Or create a Go-based extension
5gh extension create --precompiled=go my-extension

Troubleshooting

Extension Not Found

If you get an error that an extension is not found:

  1. Check the repository exists and is public
  2. Ensure the repo has the gh-extension topic
  3. Verify the repo has a valid extension manifest

Permission Denied

If you get permission errors:

1# Re-authenticate with required scopes
2gh auth refresh -s read:org

Resources