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: error
  • 2: command canceled
  • 4: 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