Blog/AI Agents/GitHub Copilot CLI: How to Install and Use It in Your Terminal (2026 Guide)

GitHub Copilot CLI: How to Install and Use It in Your Terminal (2026 Guide)

GitHub Copilot CLI is a standalone terminal agent, installed with `npm install -g @github/copilot`, separate from the old `gh-copilot` extension.

Antoni Seba·8 sierpnia 2026·10 min read

TL;DR

  • GitHub Copilot CLI is a standalone terminal agent, installed with npm install -g @github/copilot, separate from the old gh-copilot extension.
  • The old gh copilot explain and gh copilot suggest commands no longer work: the extension was retired on October 25, 2025 and replaced by a new tool.
  • The new Copilot CLI does not answer with a single command. It holds a conversation: it plans, edits files, runs commands, and iterates until the task is done.
  • It requires an active GitHub Copilot subscription (Free, Pro, Pro+, Business, or Enterprise) and Node.js 22 or later.
  • It works on the same principle as Claude Code: a terminal agent instead of inline suggestions in an editor, with a plan mode and an autopilot mode.

"How do I install GitHub Copilot CLI" now points to two different tools in search results. Older guides show gh extension install github/gh-copilot, newer ones talk about a separate @github/copilot package. That is not a writing error: GitHub genuinely swapped the tool underneath the name. This guide covers the state of things as of August 2026: what works today, what is dead, and how to get started without wasting time on outdated commands.

What is GitHub Copilot CLI?

GitHub Copilot CLI is a coding agent that runs directly in your terminal instead of inside a code editor. Instead of suggesting the next line as you type, it takes an instruction in plain language and carries out the task itself: it reads project files, writes code, runs tests, fixes bugs, and commits changes.

The tool bridges two worlds. On one side it works locally on your repository, the same way other terminal agents do. On the other, it has a built-in integration with GitHub.com: it can open pull requests, comment on issues, read code reviews, and trigger GitHub Actions workflows without switching to a browser.

You start it with a single command, copilot, in your project directory. From that point you talk to it the way you would talk to a teammate, not by typing a separate command for every type of task.

A practical example: you type "find every place where we call the old payment API and switch it to the new endpoint." The agent searches the repository itself, finds the calls, proposes changes file by file, and asks for approval before writing anything. You don't need to know the file names or write your own regex.

What happened to gh copilot explain and gh copilot suggest?

The gh copilot explain and gh copilot suggest commands stopped working because the extension they came from was retired. If you landed here from a guide written before 2026, it's worth knowing before you copy those old commands.

The old gh-copilot extension for GitHub CLI worked on a simple principle: gh copilot suggest "undo the last commit" returned one command suggestion, gh copilot explain "sudo apt-get update" translated the command into plain language. No context memory, no file editing, one answer to one question.

GitHub retired that extension on October 25, 2025, and the repository was archived five days later. The reason wasn't cosmetic. The new Copilot CLI is a different class of tool: a terminal agent that plans multi-step tasks, not a simple helper answering with one line.

The equivalent today looks like this: instead of gh copilot explain "sudo apt-get update", you type in a Copilot CLI session "explain this command: sudo apt-get update." Instead of gh copilot suggest "undo the last commit", you type "give me a command to undo the last commit." Conversation replaced rigid syntax.

How to install GitHub Copilot CLI, step by step

You install GitHub Copilot CLI with a single command, picking the package manager that matches your system. You need an active GitHub Copilot subscription and, if installing through npm, Node.js version 22 or later.

Four install methods: npm, Homebrew, WinGet, or a shell script, all documented in the official project repository:

macOS and Linux (npm, any system with Node.js):

npm install -g @github/copilot

macOS and Linux (Homebrew and WinGet):

brew install --cask copilot-cli

Windows (WinGet, requires PowerShell 7 or later):

winget install GitHub.Copilot

Install script (macOS and Linux, no npm needed):

curl -fsSL https://gh.io/copilot-install | bash

Homebrew, WinGet, and the shell script all update automatically with new releases. The npm install requires a manual npm update -g @github/copilot from time to time. If you work in GitHub Codespaces, the tool is already built into the default image and there's nothing to install.

After installing, check the version with copilot --version to confirm it worked. One trap with the npm install: if ~/.npmrc has ignore-scripts=true set, the standard command fails silently. You then need to reinstall with that option explicitly overridden, or the tool won't finish configuring itself even though the terminal shows no error.

Signing in and running your first session

You start your first session with the copilot command inside a project directory, and sign in with the /login command directly inside the tool. There's nothing to configure ahead of time, no tokens or API keys.

Step by step:

  1. Move into your project directory in the terminal.
  2. Run copilot.
  3. On first launch the tool prompts you to run the /login command. Enter it and complete the standard GitHub sign-in flow in your browser.
  4. Approve the directory as trusted. Copilot CLI asks for this the first time it runs in a new folder, so it doesn't execute commands in places you haven't reviewed.

For automation and CI/CD, sign-in is also available through an environment variable (GH_TOKEN or GITHUB_TOKEN) with a token that has the "Copilot Requests" permission, skipping the interactive browser flow entirely.

Once signed in, keep your first prompt simple, something like "describe the structure of this project and point out the main modules." The answer shows you immediately how the agent reads the code and whether it sees the whole directory, before you hand it something that actually changes files.

What working with GitHub Copilot CLI looks like day to day

A typical session starts with one sentence describing the goal, not the mechanics. Example: "analyze src/auth.py, write tests for every public function, and run them."

Copilot CLI reads the file, understands the code structure, writes tests, runs them, and shows the results. Before any operation that changes files or runs a system command, the tool asks for approval, unless you've switched on full autonomy. You can approve a single command, approve everything for the rest of the session, or block a specific tool entirely.

For specialized work, Copilot CLI automatically delegates to focused subagents. Four main roles:

  • Explore: searches and analyzes the project's codebase.
  • Task: runs builds and tests and verifies the results.
  • Code Review: evaluates changes before commit, looking for bugs and regressions.
  • Plan: builds an implementation plan for larger tasks.

You experience it as one conversation. Underneath, several specialized modules are doing narrower, focused work.

Tasks with a clearly defined scope can also run outside an interactive session, using the -p flag with a ready-made prompt. That's useful in scripts and pipelines, where nobody is around to click "yes."

What are plan mode and autopilot mode in Copilot CLI?

Plan mode makes the agent plan the task first instead of writing code immediately. You turn it on with Shift+Tab before sending your prompt.

In this mode Copilot CLI asks clarifying questions, then builds a structured plan step by step. You see the full outline of changes before a single file is touched. It's useful for larger refactors, where the cost of a wrong assumption is high.

Autopilot is the opposite: the agent executes tools, runs commands, and iterates without stopping for each individual approval. It makes sense for tasks with a tightly bounded scope, in a repository with solid test coverage and sensible permission settings. Without those conditions, autopilot can carry a change further than you intended.

You switch between modes with the same Shift+Tab shortcut mid-session, no restart required.

A plan mode example: you ask for a data model migration from one table into two related ones. The agent first asks about backward compatibility and existing queries, then shows a plan of changes. An autopilot example: a batch of small linter fixes across the whole repository, each change verified automatically by tests, with no per-file confirmation needed.

MCP and model selection: extending what Copilot CLI can do

Copilot CLI has a built-in integration with GitHub through the GitHub MCP server, with no configuration needed: the agent can manage issues, pull requests, and workflows right away. Additional MCP servers (a database, an internal API, other project tools) are added with the /mcp add command mid-session.

You change the model the agent runs on with the /model command at any point in the conversation. Several providers are available, including Claude and GPT variants, so model choice can match the task at hand: a stronger model for a hard refactor, a faster and cheaper one for small fixes.

That's one of the bigger differences compared to tools locked to a single model provider. You don't need to switch tools to switch models.

Extra MCP servers get added per project: a database server, an internal company API, or an automation tool such as n8n. The agent treats each of them as one more tool available in the conversation, with no separate integration work on the code side.

GitHub Copilot CLI vs Claude Code: which terminal agent should you pick?

Both tools solve the same problem: an agent in the terminal instead of inline suggestions in an editor. The difference is what they're tied to.

Copilot CLI is deeply integrated with the GitHub ecosystem: pull requests, issues, GitHub Actions, and code review all work out of the box, with no extra setup. A good fit if your team's whole workflow already revolves around GitHub.com.

Claude Code is independent of the platform hosting your code: integration with GitHub, GitLab, or your own server happens through MCP, it isn't built in by default. You pay for access to Anthropic's models directly, without a Copilot subscription in between. We cover the exact differences in day-to-day use, cost, and team workflow in our comparison of Claude Code and Cursor.

Practical recommendation: if your team lives in GitHub Issues and pull requests, Copilot CLI saves time on integrations. If you're building production agents that need to stay independent of one hosting platform, Claude Code's flexibility pays off. Many of the teams we work with on AI agent rollouts use both at once: Copilot CLI for tasks tied closely to GitHub, a second agent for the rest of the automation.

Criterion GitHub Copilot CLI Claude Code
GitHub integration Built-in (PR, issues, Actions) Via MCP
Model choice Multiple providers, /model switch Anthropic models
Billing Part of the Copilot subscription Separate plan or API
Best for Teams deeply embedded in GitHub Platform-independent agents

How much does GitHub Copilot CLI cost?

GitHub Copilot CLI doesn't have its own price tag: it costs whatever you already pay for your GitHub Copilot subscription. Every subscriber has access: Free, Pro, Pro+, Business, and Enterprise.

For Business and Enterprise accounts, an organization admin has to turn on Copilot CLI in the policy panel before the team can use it. That's a one-time setting, not an extra charge.

The Free plan really only makes sense for testing: request limits hit fast under daily use. For regular work, Pro is the realistic minimum, billed monthly in dollars like any SaaS tool in this category.

Since the tool rides on an existing subscription, the "should we roll this out" decision comes down to whether the team already pays for Copilot, not a separate budget line.

If you're figuring out how to put together a full agentic stack for your company, not just one tool, talking to a team that deploys this daily saves weeks of trial and error. Check our AI services, or reach out if you want to test a few agents against a real repository before deciding.

Have a project? Let's talk.

Free consultation and quote within 24h. No commitment.

Get a free quote