gh-copilot
Provide AI-powered programming assistance
TLDR
Suggest a command, given a description
Suggest a Git command
Explain a command
Generate shell-specific aliases for Bash
Generate shell-specific aliases for Zsh
Configure options
SYNOPSIS
gh copilot suggest|explain [flags] [<args>]
PARAMETERS
suggest [<prompt>]
Generate shell commands from a natural language description (stdin if omitted)
explain <command>
Explain a given shell command in detail (stdin if omitted)
--shell <type>
Target shell: bash, zsh, fish, powershell, pwsh (default: auto detects from $SHELL)
--debug
Enable verbose debug logging for troubleshooting
DESCRIPTION
The gh copilot command (installed as the GitHub CLI extension gh-copilot) brings GitHub Copilot's AI capabilities directly to your terminal. It helps developers by generating shell command suggestions from natural language prompts or explaining complex commands in plain English.
Use gh copilot suggest to describe what you want to do, like 'list files modified in the last week', and it outputs ready-to-run commands tailored to your shell (bash, zsh, fish, etc.).
With gh copilot explain, paste any command, and it breaks it down step-by-step, highlighting what each part does, potential risks, and alternatives.
Powered by GitHub's Copilot models, it integrates seamlessly with gh auth for secure access. Ideal for speeding up workflows, learning new tools, or troubleshooting. Requires internet and a GitHub account with Copilot enabled. Currently in public preview.
CAVEATS
Requires GitHub CLI (>=2.40), internet connection, and gh auth login with Copilot access (paid seat needed). Experimental/public preview; outputs may need review for accuracy/security. Not for sensitive data.
INSTALLATION
gh extension install github/gh-copilot
Enable Copilot in GitHub settings > Copilot > CLI.
USAGE TIPS
Pipe output to shell: gh copilot suggest '...' | bash
Review AI suggestions before executing.
HISTORY
Released by GitHub in February 2024 as open-source extension (github/gh-copilot). Built on Copilot API, evolved from internal tools to public preview for faster terminal productivity.


