GH-COMPLETION(1)
β¨ GH-COMPLETION(1) β¨
okay so this is the gh-completion page from the GitHub CLI manual (gh manual, bestie, the official one) β and it's literally the glow-up your shell has been waiting for π
π NAME π
gh-completion β generate shell completion scripts β¨
π¦ SYNOPSIS π¦
gh completion -s <shell>
πΈ DESCRIPTION πΈ
Generate shell completion scripts for GitHub CLI commands. no cap, that's the whole vibe β your shell learns all the gh commands and subcommands and just knows them π§
Real talk though: if you installed GitHub CLI through a package manager, there's a solid chance you don't need to do any extra shell configuration to gain completion support. For Homebrew specifically, go peek at β¨https://docs.brew.sh/Shell-Completionβ© π
But if you do need to set up completions manually, follow the instructions below, bestie. Heads up: the exact config file locations might vary based on your system (everyone's setup is a little different, iykyk). And make sure you restart your shell before testing whether completions are working β otherwise you'll be sitting there like "why isn't this working π" and it's just because your shell hasn't reloaded. π
π bash
First, ensure that you install bash-completion using your package manager.
After, add this to your ~/.bash_profile:
eval "$(gh completion -s bash)"
π zsh
Generate a _gh completion script and put it somewhere in your $fpath:
gh completion -s zsh > /usr/local/share/zsh/site-functions/_gh
Ensure that the following is present in your ~/.zshrc:
autoload -U compinit
compinit -i
Zsh version 5.7 or later is recommended. π
π fish
Generate a gh.fish completion script:
gh completion -s fish > ~/.config/fish/completions/gh.fish
π PowerShell
Open your profile script with:
mkdir -Path (Split-Path -Parent $profile) -ErrorAction SilentlyContinue
notepad $profile
Add the line and save the file:
Invoke-Expression -Command $(gh completion -s powershell | Out-String)
β OPTIONS β
-s,--shell <string>β shell type, and your choices are{bash|zsh|fish|powershell}π¦
π₯ EXIT CODES π₯
0: successful execution β we ate π1: error2: command canceled4: authentication required π
NOTE: specific commands may have additional exit codes. refer to the command's help for more information, bestie β don't just assume these four are the whole story for every single command π«Ά
π SEE ALSO π
and that's the page, fr fr π brought to you by GitHub CLI v2.102.0, dated Oct 2026 β mwah, go restart your shell and slay β¨π
π¦ where this page comes from
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms