Skip to main content

GitHub Copilot CLI Cheatsheet

GitHub Copilot CLI is GitHub's AI terminal assistant, available as a gh extension that provides command suggestions (suggest) and command explanations (explain) to help you work more efficiently in the terminal.

Updated: 2026-07-17·27 commands

Overview

GitHub Copilot CLI brings AI assistance to your terminal, letting you describe tasks in natural language to get command suggestions or explanations. Available as a gh extension, it integrates deeply with the GitHub ecosystem.

Quick Start

``bash # Install GitHub CLI (if not installed) # macOS brew install gh # Ubuntu/Debian sudo apt install gh

# Install Copilot CLI extension gh extension install github/gh-copilot

# Login to GitHub gh auth login --web

# Use the Suggest feature gh copilot suggest "Find all large log files" ``

Refer to the command table below for detailed usage.

Installation & Setup

Copilot CLI is distributed as a gh extension. Before installing, ensure you have GitHub CLI (>= 2.0.0) installed and are logged into a GitHub account. Supports macOS, Linux, and Windows.

Command Suggest

Describe what you want to accomplish in natural language, and Copilot CLI recommends terminal commands. Supports interactive selection and direct execution. The ghcs alias provides faster access.

Command Explain

Paste or type a terminal command, and Copilot CLI explains what it does, what each flag means, and the overall effect — helping you understand complex commands or learn new tools.

Configuration & Aliases

Manage settings with gh copilot config, and set up shell aliases for bash, zsh, or PowerShell with gh copilot alias. Supports GH_HOST env var and --hostname flag for GitHub Enterprise instances.

Install & Setup(6)

CommandLevel
gh extension install
Install Copilot CLI gh extension
Basic
gh auth login --web
Login to GitHub account via browser
Basic
gh auth login
Login to GitHub account via token
Basic
gh copilot --help
View Copilot CLI help information
Basic
gh extension upgrade
Upgrade Copilot CLI extension to latest
Basic
gh extension remove
Remove Copilot CLI extension
Basic

Command Suggest(6)

CommandLevel
gh copilot suggest
Suggest terminal commands based on natural language
Basic
gh copilot suggest -t
Specify command type (shell/gh/git)
Intermediate
gh copilot suggest -t shell
Get general shell command suggestions
Basic
gh copilot suggest -t git
Get git command suggestions
Basic
gh copilot suggest -t gh
Get GitHub CLI command suggestions
Basic
Execute suggested command
Select to execute the suggested command
Intermediate

Command Explain(3)

CommandLevel
gh copilot explain
Explain what a terminal command and its flags do
Basic
gh copilot explain complex
Explain each part of a complex piped command
Expert
gh copilot explain --full
Full explanation of every option and argument
Intermediate

Configuration(6)

CommandLevel
gh copilot config
View or modify Copilot CLI configuration
Intermediate
gh copilot config set
Set a configuration value
Intermediate
gh copilot config get
Get a specific configuration value
Intermediate
--hostname
Specify GitHub Enterprise Server hostname
Intermediate
GH_HOST
Environment variable for GitHub Enterprise hostname
Intermediate
gh copilot version
Check Copilot CLI version
Basic

Aliases(6)

CommandLevel
gh copilot alias
Set up shell aliases (interactive wizard)
Basic
gh copilot alias bash
Set up aliases for Bash (ghcs/ghce)
Basic
gh copilot alias zsh
Set up aliases for Zsh (ghcs/ghce)
Basic
gh copilot alias pwsh
Set up aliases for PowerShell (ghcs/ghce)
Basic
ghcs
Shortcut alias for gh copilot suggest
Basic
ghce
Shortcut alias for gh copilot explain
Basic

FAQ

This cheatsheet is compiled from official tool documentation. Last updated: 2026-07-17.