GitHub Copilot CLI
Last reviewed · content updated
BeginnerWhat you'll learn
~15 min- Install the standalone Copilot CLI
- Authenticate with your GitHub account
- Run your first task in interactive mode
- Understand programmatic mode and tool approval
Copilot in VS Code works inside GitHub Codespaces — get the full Copilot experience (autocomplete, chat, and CLI) without any local install. See the Cloud Sandbox Cheat Sheet for current pricing, or set up your sandbox.
By the end of this lesson, you’ll have the new standalone Copilot CLI installed and working — a full agentic coding tool comparable to Claude Code and Antigravity, not just a helper for looking up commands.
What is GitHub Copilot CLI?
GitHub Copilot CLI is GitHub’s standalone agentic AI tool for the terminal. It is a complete rewrite — the old gh copilot extension (with its suggest and explain commands) has been retired. The new Copilot CLI is a fully autonomous agent that reads your codebase, edits files, runs commands, and iterates on errors, just like Claude Code and Antigravity.
Key features:
- Full agentic coding — reads, writes, and edits files across your project
- Auto model selection (GA July 2026) routes each task to a current model — the picker includes Claude Fable 5.1 / Opus 5 / Sonnet 5, GPT-5.6, and Gemini 3.8 Flash, with GPT-6 Astra arriving as the rollout reaches your account (in the CLI from v1.0.84). Paid plans can pin one with
/model; Free and Student plans are Auto-only. Fable 5.1 and Astra start at Pro+, and on Business and Enterprise an admin has to switch Fable 5.1 on — its policy ships off - Plan mode —
/plan(orcopilot --mode plan) outlines the work before execution - Tool approval controls — fine-grained control over what the agent can do
- MCP support — connects to external tools and services
- Context management —
/compactto free up context,/contextto see token usage - Deep GitHub integration — works seamlessly with Issues, PRs, and Actions
- Free tier available — works with Copilot Free (no credit card required)
Prerequisites
Copilot Free is available to anyone with a GitHub account at no cost. It includes the CLI, a monthly code-completion allowance, and an allowance of AI Credits for chat and agent work (GitHub doesn’t publish the exact number for either; Auto model selection only). No credit card, no application, no waiting — just sign in. This makes Copilot CLI the lowest-barrier entry point of any AI CLI tool.
All you need is a GitHub account. If you don’t have one, create one at github.com — it’s free.
Copilot plans at a glance:
As of June 1, 2026 GitHub replaced the old per-request counters with AI Credits — a token-based system that applies to chat and agentic tasks across all plans. One credit is $0.01, consumed at each model’s API rate; code completions and Next Edit suggestions remain unlimited and unmetered on all paid plans, and pay-as-you-go overage is available if you run out.
| Plan | Price | CLI Access | Notes |
|---|---|---|---|
| Copilot Free | $0 | Yes | Unpublished completion and AI-Credit allowances; Auto model only — open to everyone |
| Copilot Student | $0 (verified students) | Yes | Unpublished completion and AI-Credit allowances; Auto model only |
| Copilot Pro | $10/mo | Yes | 1,500 AI Credits/mo (worth $15); completions unmetered |
| Copilot Pro+ | $39/mo | Yes | 7,000 AI Credits/mo (worth $70); premium models |
| Copilot Max | $100/mo | Yes | 20,000 AI Credits/mo (worth $200); priority access to new models |
| Copilot Business | $19/seat/mo | Yes | 1,900 AI Credits/user/mo (the 3,000 promotional allowance ended 2026-08-31) — org-managed, + admin controls |
| Copilot Enterprise | $39/seat/mo | Yes | 3,900 AI Credits/user/mo (the 7,000 promotional allowance ended 2026-08-31) — org-managed, + knowledge bases, enterprise controls, audit |
GitHub doesn’t publish exact completion or AI-Credit allowances for Free or Student. The Business and Enterprise allowances shrank on 2026-09-01 because a promotional period ended, not because prices changed — the seat prices are unchanged. From 2026-10-01, every assigned Business or Enterprise seat is charged upfront, and going past the included usage can require additional payment before users continue. Overage is billed by default (1 credit = $0.01) unless your org sets a spending limit.
Sign-ups are open again. GitHub paused new Pro/Pro+/Student enrollment in spring 2026 and reopened it on June 17, 2026; Free and Student plans use Auto model selection only (since June 24, 2026). Copilot Business and Enterprise sign-ups, which had been closed, began reopening on September 1, 2026 — gradually, over the following weeks — for customers paying by credit card or PayPal — from 2026-10-01 every assigned seat there is charged upfront, and existing Business/Enterprise seats on that payment method pick up the same upfront per-seat charge starting with billing cycles from October 1, 2026. Check github.com/features/copilot/plans for the latest.
Gemini 3.1 Pro, Claude Opus 4.5, Claude Opus 4.6, Claude Sonnet 4.5, Claude Sonnet 4.6, and Raptor Mini are no longer offered across Copilot Chat, inline edits, ask/agent modes, and code completions — the CLI included. The one carve-out: Claude Sonnet 4.6 remains available to individual GitHub Copilot subscribers on annual plans. If a picker still shows one of the other retired names, an admin needs to enable a replacement through Copilot’s model policies first.
Next wave: GitHub scheduled Gemini 3.5 Flash and 3.6 Flash for retirement on 2026-10-02 (use Gemini 3.8 Flash), along with Claude Opus 4.7 (use Opus 5) and Kimi K2.7 Code (use Kimi K3), across the same surfaces.
Education access:
- Students: the Copilot Student plan is free while you’re verified — an unpublished monthly AI-Credit allowance, Auto model only — and comes with the Student Developer Pack. You can upgrade to Pro and keep the pack
- Educators: Verified teachers may qualify for free Copilot benefits — check education.github.com for current terms
- Institutions: Free GitHub Enterprise is available through the GitHub Campus Program, but Enterprise access alone does not include Copilot licenses — those must be assigned separately
🧬In Your Field: Biotechclick to expand
UW-Madison staff: Copilot Free works immediately for anyone with a personal GitHub account — no institutional approval needed. If you teach or supervise students in your core facility, you may also qualify for educator benefits. Check with your GitHub Campus Program administrator about whether UW has Copilot Business licenses available through the institutional agreement.
Installation
The new Copilot CLI is a standalone tool — it does not require the GitHub CLI (gh). Choose whichever install method works for your system:
Option A: npm (any platform — recommended if you have Node.js 22+)
npm install -g @github/copilotOption B: Homebrew (macOS / Linux)
brew install --cask copilot-cliOption C: winget (Windows native)
winget install GitHub.CopilotOption D: Quick install script (macOS / Linux / WSL)
curl -fsSL https://gh.io/copilot-install | bashVerify the installation
copilot --versionYou should see a version number (something like 1.0.81). If you get “command not found,” restart your terminal and try again — the installer may have updated your PATH.
Authentication
First launch
copilotOn first launch, Copilot CLI will prompt you to authenticate. Run /login if prompted, or it will open the GitHub device flow automatically — you’ll see a URL and a one-time code to enter in your browser. This works even from remote servers over SSH.
Once authenticated, you’ll see the interactive prompt:
> copilotWelcome to GitHub Copilot CLI!Type your request, or /help for commands.You’re in.
How Copilot CLI works
Copilot CLI operates in two modes: interactive and programmatic. Both are fully agentic — the tool reads your project, plans changes, edits files, and runs commands.
Interactive mode (default)
copilotThis opens a persistent session where you type requests, review the agent’s plan, and approve actions. It’s the mode you’ll use most often — just like using Claude Code or Antigravity interactively.
Programmatic mode
copilot -p "add error handling to all API routes"The -p flag runs a single prompt non-interactively and exits. Useful for scripting, CI pipelines, or quick one-off tasks.
Your first interaction
Navigate to a project directory (or create one) and launch Copilot:
mkdir copilot-test && cd copilot-testcopilotTry a simple request:
Create an index.html file with a "Hello World" page that has a centered heading and a dark backgroundCopilot will plan the task, create the file, and show you the result. Review the output and approve any file writes.
Plan mode
Type /plan (or launch with copilot --mode plan) to enter plan mode. In plan mode, Copilot creates a structured plan for your request and waits for your approval before executing. This is especially useful for multi-step tasks where you want to review the strategy first.
Key commands
| Command | What it does |
|---|---|
/help | Show available commands |
/model | Switch the underlying AI model |
/compact | Compress conversation to free up context |
/context | Show current token usage |
/login | Authenticate with GitHub |
/clear | Clear the conversation |
/plan | Plan the work before executing (--mode plan at launch) |
/rewind | Step back to an earlier checkpoint |
/mcp | Manage MCP servers |
/usage | Show usage and credit consumption |
/limits | Cap how many AI Credits a session may spend |
Newer builds add /autopilot (run without approval prompts), /delegate — or an & prefix — to hand a task to Copilot’s cloud agent, which opens a PR, /fleet (run subagents in parallel), /tasks, /worktree, /skills, and /plugin (the old /plugins dashboard command was retired in v1.0.81 and split into /plugin, /mcp, and /skills). Run /help for the current full set — Copilot CLI’s command surface is expanding quickly.
Tool approval
Copilot CLI asks for permission before running commands or writing files. You control this with flags:
# Allow specific toolscopilot --allow-tool='shell(git)'
# Allow all tools (no approval prompts — use with caution; `--yolo` also allows all paths and URLs)copilot --allow-all-tools
# Block specific tools — deny rules win even when everything else is allowedcopilot --allow-all-tools --deny-tool='shell(rm)' --deny-tool='shell(git push)'
# Put a ceiling on spend for an autonomous runcopilot --mode autopilot --max-ai-credits 50 -p "fix the failing tests"Like all agentic AI tools, Copilot will ask before running commands. Always read what it’s about to do — especially for destructive operations like rm, git reset --hard, or database modifications. When you’re learning, keep the default approval prompts on.
Custom instructions
Create a .github/copilot-instructions.md file in your project root to give Copilot persistent context about your project’s conventions, architecture, and preferences. This works similarly to Claude Code’s CLAUDE.md and Antigravity’s GEMINI.md / AGENTS.md.
🧬In Your Field: Biotechclick to expand
Copilot CLI’s agentic capabilities are powerful for bioinformatics workflows. Instead of memorizing complex tool syntax, describe what you need: “Parse this FASTQ file, filter reads with quality score above 30, and write the results to a new file.” Copilot will plan the approach, choose the right tools (samtools, seqkit, etc.), and execute the pipeline — asking for your approval at each step. For complex multi-step analyses, use plan mode (/plan) to review the strategy before execution.
🏛️In Your Field: Government / State Devclick to expand
Government developers working across multiple deployment environments will appreciate Copilot’s tool approval controls. You can allow specific tools while blocking risky ones: copilot --allow-tool='shell(git)' --deny-tool='shell(rm)'. The deep GitHub integration also means Copilot understands your Issues and PRs natively — useful for agencies that use GitHub for project tracking and compliance documentation.
Copilot CLI vs the other tools
| Aspect | Copilot CLI | Claude Code | Codex CLI | Antigravity CLI |
|---|---|---|---|---|
| Default model | Auto routing (GA July 2026); /model to pin one on paid plans | Sonnet 5 (Pro), Opus 5 (Max) | GPT-6 Astra (default from CLI 0.153.4 as the rollout reaches you); Sol, Terra, and Luna available | Gemini 3.8 / 3.7 / 3.6 Flash and 3.1 Pro, plus Claude 4.6 and GPT-OSS; /model |
| Session model | Persistent conversation | Persistent conversation | Persistent conversation | Persistent conversation |
| File editing | Reads, writes, edits | Reads, writes, edits | Reads, writes, edits | Reads, writes, edits |
| Plan mode | /plan or --mode plan | /plan or Shift+Tab | /plan | Shift+Tab to plan mode |
| Free tier | Copilot Free (limited credits, Auto model) | None — paid plan required | Limited (GPT-5.6 Terra only) | Yes — weekly limits |
| Best for | GitHub-integrated workflows | Deepest codebase reasoning | OpenAI ecosystem, Codex Cloud | Google models, free tier, huge context |
| MCP support | Yes | Yes | Yes | Yes |
Antigravity note: Google retired the consumer Gemini CLI on 2026-06-18; individuals now use Antigravity CLI (
agy). Enterprise Gemini Code Assist licenses and API keys keep Gemini CLI — see the Antigravity lesson.
All four are full agentic coding tools. The biggest differentiator is ecosystem fit: Copilot CLI integrates deeply with GitHub Issues/PRs/Actions, Claude Code excels at codebase reasoning, Codex CLI plugs into the OpenAI/Codex Cloud workflow, and Antigravity gives you Google’s models with a real free tier. There’s no “free Claude Code” tier — Claude Code requires Pro or higher.
Copilot Chat in VS Code
While you’re here, it’s worth knowing that Copilot Chat in VS Code now offers four modes:
- Ask — ask questions about your codebase
- Edit — make targeted edits to specific files
- Agent — autonomous multi-file coding (similar to using Copilot CLI)
- Plan — create and review structured plans before executing
These are complementary to the CLI — use VS Code’s Copilot Chat when you want visual context, and the CLI when you want speed and automation.
Verify it works
Paste this exact command to confirm everything is set up correctly:
copilot --versionYou should see a version number printed. If you get an error, make sure copilot is installed and in your PATH (see installation steps above).
If the version check worked, try this — your first real interaction with the new Copilot CLI:
copilot -p "list all files in the current directory and describe what each one does"If you see a response, congratulations — you’re ready to use GitHub Copilot CLI for real work starting in Module 9.
When Things Go Wrong
Use the Symptom → Evidence → Request pattern: describe what you see, paste the error, then ask for a fix.
Key Takeaways
- Copilot CLI is now a full agentic coding tool — the old
gh copilot suggest/explainextension has been retired, replaced by a standalonecopilotcommand - Free tier with zero friction — Copilot Free gives CLI access to anyone with a GitHub account, no credit card required
- Interactive and programmatic modes —
copilotfor persistent sessions,copilot -p "prompt"for one-off tasks - Tool approval keeps you safe — fine-grained
--allow-tooland--deny-toolflags control what the agent can do - Deep GitHub integration — the standout advantage over other AI CLI tools, with native understanding of Issues, PRs, and Actions