GitHub Copilot CLI is GitHub's AI coding agent for the terminal. You install it with npm install -g @github/copilot (or Homebrew or WinGet), run copilot in a project folder, and ask it in plain language to explain code, make changes, run commands or work with GitHub issues and pull requests, approving each risky tool the first time it is used.
GitHub's docs describe it this way: "The command-line interface (CLI) for GitHub Copilot allows you to use Copilot directly from your terminal." This guide covers install, permissions, scripting and customization, based on GitHub's Copilot CLI documentation read on 24 October 2026.
How do you install Copilot CLI?
You need an active GitHub Copilot subscription and, on Windows, PowerShell 6 or later. If you get Copilot through an organization, the owner must not have disabled the CLI. The install page lists these methods:
| Method | Command |
|---|---|
| npm (all platforms, Node.js 22+) | npm install -g @github/copilot |
| Homebrew (macOS, Linux) | brew install --cask copilot-cli |
| WinGet (Windows) | winget install GitHub.Copilot |
There is also an install script for macOS and Linux:
curl -fsSL https://gh.io/copilot-install | bash
The npm, Homebrew and WinGet methods each have a prerelease variant, such as npm install -g @github/copilot@prerelease. You can also download binaries from the github/copilot-cli releases. It runs on Linux, macOS and Windows (PowerShell and WSL).
On first launch, run /login if prompted and follow the steps. For scripts and CI, you can instead use a fine-grained personal access token with the Copilot Requests permission, exported as COPILOT_GITHUB_TOKEN, GH_TOKEN or GITHUB_TOKEN (in that order of precedence).
How do you start a session?
Open a terminal in your project and run copilot. It first asks whether you trust the files in that folder: yes for this session, yes and remember the folder, or no. GitHub advises against launching it from your home directory or any folder with files you do not trust.
Then type a request. Examples from GitHub's docs:
Change the background-color of H1 headings to dark blueShow me the last 5 changes made to the CHANGELOG.md file. Who changed the file, when, and give a brief summary of the changes they madeList my open PRsI've been assigned this issue: https://github.com/octo-org/octo-repo/issues/1234. Start working on this for me in a suitably named branch.
Because the GitHub MCP server comes preconfigured, it can list issues, open pull requests and check PR changes on GitHub.com. Pull requests it creates list you as the author.
Useful habits inside a session:
@path/to/fileadds a file to your prompt; images and PDFs work too with a model that supports them.!commandruns a shell command directly without calling the model.- Shift+Tab cycles modes, including plan mode, where Copilot asks clarifying questions and builds a plan before writing code.
- Press Esc twice to stop an operation that is still thinking.
/resumeorcopilot --continuepicks up an earlier session./context,/usageand/compactshow and manage your context window and AI credit use.
How do tool approvals and permissions work?
The first time Copilot wants a tool that can modify or run files, such as touch, chmod, node or sed, it asks:
1. Yes
2. Yes, and approve TOOL for the rest of the running session
3. No, and tell Copilot what to do differently (Esc)
Option 2 is broad. Approving rm once for the session lets Copilot run any rm command until you exit.
For scripted or hands-off runs, use flags:
| Flag | Effect |
|---|---|
--allow-all-tools |
Any tool runs without asking |
--allow-tool='shell(git)' |
Allow one tool or command family |
--deny-tool='shell(git push)' |
Block one tool; overrides the allow flags |
--allow-tool='write' |
Allow file edits without asking |
--allow-tool='My-MCP-Server(tool_name)' |
Allow one MCP tool |
--allow-all or --yolo |
Enable all permissions at once |
A common safe pattern is "allow everything except destructive commands":
copilot --allow-all-tools --deny-tool='shell(rm)' --deny-tool='shell(git push)'
GitHub's caution is worth quoting: with automatic approval, "Copilot has the same access as you do to files on your computer, and can run any shell commands that you can run." To reduce the risk, run /sandbox enable for local sandboxing, which restricts the filesystem, network and system access of commands Copilot runs, or start a cloud sandbox with copilot --cloud (in public preview).
How do you use Copilot CLI in scripts?
Pass a prompt with -p or --prompt; the CLI completes the task and exits:
copilot -p "Show me this week's commits and summarize them" --allow-tool='shell(git)'
Combine it with approval flags so it can actually change files. For longer unattended work, autopilot mode keeps going without stopping for input; GitHub's example caps it with --max-autopilot-continues:
copilot --autopilot --yolo --max-autopilot-continues 10 -p "YOUR PROMPT HERE"
Run copilot help for every option, and copilot help permissions, copilot help config or copilot help environment for details.
How do you customize Copilot CLI?
Custom instructions. Copilot CLI reads .github/copilot-instructions.md, .github/instructions/**/*.instructions.md, AGENTS.md, CLAUDE.md and GEMINI.md, plus ~/.copilot/copilot-instructions.md for personal rules. It combines all of them, so keep them consistent. Use /instructions to see and toggle what loaded. The custom instructions guide explains the formats.
MCP servers. Add a remote server without opening a session:
copilot mcp add --transport http sentry https://mcp.sentry.dev/mcp
Or use /mcp add inside a session. Server details go in ~/.copilot/mcp-config.json.
Custom agents. Built-in agents include Explore, Task, General purpose, Code review, Research and Rubber duck. Your own agent profiles go in ~/.copilot/agents or .github/agents; pick one with /agent or --agent=NAME.
Skills. Copilot supports the open Agent Skills format. GitHub's agent skills page lists project skills in .github/skills, .claude/skills or .agents/skills, and personal skills in ~/.copilot/skills or ~/.agents/skills.
Hooks. JSON files in .github/hooks/ (or ~/.copilot/hooks/) run shell commands at events such as sessionStart and preToolUse.
Which models does Copilot CLI use?
Switch with /model or --model. Interactions consume AI credits based on tokens processed, and the amount varies by model. Newer models offer an optional 1 million token context window and configurable reasoning levels, both of which use more credits. You can also point the CLI at your own provider with COPILOT_PROVIDER_BASE_URL, COPILOT_PROVIDER_TYPE (openai, azure or anthropic), COPILOT_PROVIDER_API_KEY and COPILOT_MODEL; the model must support tool calling and streaming.
How does Copilot CLI connect to the cloud agent?
Use /delegate followed by a prompt, or start a prompt with &, to hand the task to Copilot cloud agent. It offers to commit your unstaged changes to a new branch, then the cloud agent opens a draft pull request and keeps working even if you close your laptop. You can also resume a cloud agent session locally with /resume.
How does it compare with other terminal agents?
Copilot CLI sits alongside Codex CLI, Gemini CLI and Claude Code; see Claude Code vs Copilot for one comparison. Its clearest strength is GitHub integration out of the box. Since it reads AGENTS.md, CLAUDE.md and shared skill folders, much of your setup carries over between these tools.
Keep prompts and skills in one place
If you reuse the same prompts and skills across terminal agents, Kipt keeps them as Markdown in a private GitHub repo you own, with fill-in blanks, tags and Cmd+K search, and imports skills from a GitHub link, folder or .zip.