How to install GitHub Copilot CLI on GitHub Copilot

intermediate 8 min read Updated 2026-03-18
Quick Answer

Install GitHub Copilot CLI by running npm install -g @githubnext/github-copilot-cli, then authenticate with gh auth login and configure with copilot auth. The CLI provides AI-powered command suggestions directly in your terminal.

Prerequisites

  • Active GitHub Copilot subscription
  • Node.js 16 or higher installed
  • Git installed on your system
  • Command line/terminal access

Step-by-Step Instructions

1

Verify Prerequisites

Open your terminal and check that Node.js is installed by running node --version. Ensure you have version 16 or higher. Also verify Git is installed with git --version. If either is missing, install them before proceeding.
Use nvm (Node Version Manager) to easily manage Node.js versions if you need to upgrade.
2

Install GitHub CLI

First install the GitHub CLI if you haven't already. On macOS, run brew install gh. On Windows, use winget install --id GitHub.cli. On Linux, follow the installation instructions at cli.github.com. Verify installation with gh --version.
The GitHub CLI is required for authentication and integration with Copilot services.
3

Install GitHub Copilot CLI Extension

Install the Copilot CLI extension by running gh extension install github/gh-copilot. This will download and install the latest version of the Copilot CLI extension directly through the GitHub CLI.
4

Authenticate with GitHub

Authenticate your GitHub CLI with your account by running gh auth login. Select GitHub.com, choose HTTPS as your preferred protocol, and select Login with a web browser. Follow the browser prompts to complete authentication.
Make sure you're logged into the GitHub account that has Copilot access.
5

Verify Copilot Access

Check that your account has Copilot access by running gh copilot --help. You should see the help menu with available commands like explain and suggest. If you get an error, verify your Copilot subscription is active.
Contact your organization admin if you're on a business plan and don't have access.
6

Test Basic Functionality

Test the installation by running gh copilot suggest "list files in current directory". Copilot should provide command suggestions like ls or dir. Try gh copilot explain "git status" to test the explain feature.
Use quotes around your prompts to ensure they're processed correctly.
7

Set Up Shell Aliases (Optional)

Create convenient aliases by adding these lines to your shell profile (.bashrc, .zshrc, etc.):
alias ghcs="gh copilot suggest"
alias ghce="gh copilot explain"
Reload your shell with source ~/.bashrc or restart your terminal.
These aliases make it faster to access Copilot CLI features during daily use.

Common Issues & Troubleshooting

Command not found error when running gh copilot

Ensure the extension is properly installed with gh extension list. If missing, reinstall with gh extension install github/gh-copilot. Make sure your GitHub CLI is updated with gh extension upgrade --all.

Authentication failed or access denied errors

Re-authenticate with gh auth logout followed by gh auth login. Verify your GitHub account has an active Copilot subscription by checking your GitHub billing settings.

Copilot suggestions are not relevant or poor quality

Be more specific in your prompts and include context about your operating system or environment. Use natural language and describe what you want to accomplish rather than technical jargon.

Extension installation fails with permission errors

On macOS/Linux, you may need to use sudo for the GitHub CLI installation. On Windows, run your terminal as Administrator. Alternatively, install GitHub CLI through official installers rather than package managers.

Prices mentioned in this guide are pulled from current plan data and may change. Always verify on the official GitHub Copilot website before purchasing.