Step-by-step instructions
- 1
Step
Verify GitHub CLI
If you get 'command not found', install it first via Homebrew (`brew install gh`) or the Windows winget (`winget install --id GitHub.cli`).
gh --version - 2
Step
Authenticate with GitHub
Ensure you log in with an account that has an active GitHub Copilot subscription.
gh auth login - 3
Step
Install the Copilot Extension
This command downloads the Copilot binaries directly from GitHub's official extension registry.
gh extension install github/gh-copilot - 4
Step
Test Copilot
You can use `gh copilot suggest` to write commands, or `gh copilot explain` to decipher complex terminal commands.
gh copilot suggest "undo my last commit"
Why this matters
Memorizing complex bash commands, ffmpeg flags, or git rebases is tedious. The GitHub Copilot CLI brings the AI assistant you already use in VS Code directly into your terminal. Instead of switching to a browser to ask ChatGPT how to find and delete large files, you can just type `gh copilot suggest` and execute the result immediately.
Troubleshooting
- **'gh: command not found':** The Copilot CLI is not a standalone tool. It is an extension for the GitHub CLI. You must install the base GitHub CLI first via Homebrew (`brew install gh`), apt, or winget.
- **Authentication errors:** The extension will fail to run if your GitHub account does not have an active Copilot Individual, Business, or Enterprise subscription.
- **Command too long to type:** Typing `gh copilot suggest` every time is slow. You can set up terminal aliases. Run `gh copilot --help` and follow the instructions to set up aliases like `??` for suggest and `?!` for explain.
FAQ
Do I need a paid GitHub Copilot subscription?
Yes. The CLI extension uses the same backend API as the VS Code extension and requires an active Copilot subscription attached to your GitHub account.
Why do I get 'extension not found'?
Ensure you type the command exactly as `gh extension install github/gh-copilot`. The 'github/' prefix specifies the official repository.
Can it execute the commands automatically?
Yes. When you use `gh copilot suggest`, it will present you with an interactive menu where you can choose to 'Execute command' directly, or revise it.
How do I update the gh copilot extension?
You can update all your GitHub CLI extensions, including Copilot, by running the command `gh extension upgrade --all`.
Is the GitHub Copilot CLI the same as Claude Code or Codex CLI?
No. GitHub Copilot CLI focuses heavily on single-command generation and explanation. Tools like Claude Code are full agentic systems designed to read entire codebases and modify multiple files autonomously.
Related tutorials
Aider
كيفية تثبيت Aider AI Coding CLI على Mac و Windows
دليل خطوة بخطوة لتثبيت Aider AI pair programming CLI على macOS و Windows. تعلم كيفية تكوين مفاتيح API لـ Claude 3.7 و GPT-4o.
Ollama
كيفية تثبيت وتشغيل Ollama CLI على Mac و Windows
دليل خطوة بخطوة لتثبيت Ollama CLI على macOS و Windows لتشغيل نماذج ذكاء اصطناعي محلية مثل Llama 3.