GitHub Copilot CLI
What 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 Gemini CLI, 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 Gemini CLI.
Key features:
- Full agentic coding — reads, writes, and edits files across your project
- Powered by Claude Sonnet 4.5 by default (changeable via
/model) - Plan mode —
Shift+Tabtoggles structured planning 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 CLI access, 2,000 code completions per month, and 50 chat messages per month. 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:
| Plan | Price | CLI Access | Notes |
|---|---|---|---|
| Copilot Free | $0 | Yes | 50 chat messages/mo, 2,000 completions/mo |
| Copilot Pro | $10/mo | Yes | Unlimited chat, more completions |
| Copilot Pro+ | $39/mo | Yes | Premium models, higher limits |
| Copilot Business | $19/user/mo | Yes | Org-managed, admin controls |
| Copilot Enterprise | $39/user/mo | Yes | Knowledge bases, fine-tuning |
Education access:
- Students: Verified students get the Copilot Student plan free through the GitHub Student Developer Pack
- Educators: Verified teachers and supervisors who teach may qualify for free Copilot Pro (unlimited usage)
- 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 the free educator Copilot Pro plan. 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)
npm install -g @github/copilotOption B: Homebrew (macOS / Linux)
brew install 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. 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 Gemini CLI 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
Press Shift+Tab to toggle 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 |
Shift+Tab | Toggle plan mode |
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)copilot --allow-all-tools
# Block specific toolscopilot --deny-tool='shell(rm)'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 Gemini CLI’s GEMINI.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 (Shift+Tab) 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 | Gemini CLI |
|---|---|---|---|
| Default model | Claude Sonnet 4.5 | Claude Sonnet 4 | Gemini 2.5 Pro |
| Session model | Persistent conversation | Persistent conversation | Persistent conversation |
| File editing | Reads, writes, edits files | Reads, writes, edits files | Reads, writes, edits files |
| Plan mode | Shift+Tab | - | Built-in |
| Free tier | 50 messages/mo (Copilot Free) | Limited (Pro plan) | 1,000 req/day (Google account) |
| Best for | GitHub-integrated workflows | Deep codebase reasoning | Large context, high daily volume |
| MCP support | Yes | Yes | Yes |
All three are full agentic coding tools. The biggest differentiator is ecosystem: Copilot CLI integrates deeply with GitHub’s Issues, PRs, and Actions. If your workflow is GitHub-centered, Copilot CLI feels native. If you need the highest daily free usage, Gemini CLI’s 1,000 requests/day is hard to beat. If you want the deepest code reasoning, Claude Code excels.
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