Based on GitHub / Microsoft’s official docs, checked
GitHub Copilot CLI: install, sign in and start using it
GitHub Copilot CLI puts Copilot’s coding agent in your terminal. You start it with copilot, ask it to change code, run commands, or work with issues and pull requests on GitHub.com, and approve what it does as it goes. It runs on Linux, macOS and Windows (PowerShell or WSL) and needs an active GitHub Copilot subscription. This guide covers installing it, signing in, the interactive and programmatic modes, choosing a model, and keeping it contained, based on GitHub’s Copilot CLI documentation checked October 26, 2026. For approval flags and yolo mode in detail, see our separate guide.
1. Check the prerequisites
You need an active GitHub Copilot subscription. On Windows you need PowerShell 6 or later. If you get Copilot through an organization or enterprise, an owner or admin can disable Copilot CLI in its settings.
2. Install with npm (any platform)
Needs Node.js 22 or later. If ~/.npmrc sets ignore-scripts=true, prefix the command with npm_config_ignore_scripts=false.
npm install -g @github/copilot3. Or use Homebrew, WinGet or the install script
Homebrew works on macOS and Linux, WinGet on Windows, and the script on macOS and Linux. The script installs to $HOME/.local for a normal user, or /usr/local when run as root; set PREFIX or VERSION to change that.
brew install --cask copilot-cli winget install GitHub.Copilot curl -fsSL https://gh.io/copilot-install | bash4. Start it and sign in
Run copilot in a project folder. On first launch, if you aren’t signed in to GitHub, run the /login slash command and follow the instructions. Copilot also asks you to confirm that you trust the folder you launched it from.
copilot5. Or sign in with a token
For scripts and CI, create a fine-grained personal access token on your personal account with the Copilot Requests permission, then export it as COPILOT_GITHUB_TOKEN (or GH_TOKEN or GITHUB_TOKEN, in that order of precedence).
export COPILOT_GITHUB_TOKEN=<your-token>
Interactive and programmatic modes
Interactive: run copilot and talk to it. Besides the default ask/execute mode there is a plan mode, where Copilot asks clarifying questions and builds an implementation plan before writing code. Press Shift+Tab to switch between them. You can send follow-up messages while it works, and when you reject a tool request you can tell it what to do instead.
Programmatic: pass one prompt with -p or --prompt and Copilot completes the task and exits. To let it edit files or run commands in this mode, add approval flags such as --allow-tool.
copilot -p "Show me this week's commits and summarize them" --allow-tool='shell(git)' What you can ask it to do
GitHub’s examples include changing code in the current project, explaining the history of a file, committing or reverting changes, and building a proof-of-concept app.
With GitHub.com it can list your open pull requests, start work on an assigned issue in a new branch, open a pull request (you are marked as the author), review the changes in a PR, open issues and create GitHub Actions workflows.
On macOS and Windows, local sessions can also enable computer use to work with desktop apps that have no API or CLI.
Approvals, trusted folders and sandboxing
The first time Copilot wants a tool that can change or run files, it asks: Yes for this command, Yes for the rest of the session, or No with feedback. Approving a tool for the session covers every use of it, so approving one rm command allows any rm command until the session ends.
Only launch Copilot CLI from folders you trust, and not from your home directory. GitHub notes that permission scoping is heuristic.
Run /sandbox enable inside a session to restrict Copilot’s access to your filesystem, network and system. copilot --cloud starts a session in a cloud sandbox, which GitHub lists as a public preview.
Models, context and usage
Change the model with /model or --model. Each interaction consumes AI credits based on tokens processed, and the amount depends on the model; see our Copilot pricing page for plan details.
The latest models offer an optional 1 million token context window and adjustable reasoning levels. Both use more credits, so GitHub recommends the default context and reasoning unless a task needs more.
Copilot compacts the conversation automatically near 95% of the token limit. /compact compresses it on demand and /context shows a token breakdown.
You can point Copilot CLI at your own OpenAI-compatible endpoint (including Ollama and vLLM), Azure OpenAI or Anthropic with COPILOT_PROVIDER_BASE_URL, COPILOT_PROVIDER_TYPE, COPILOT_PROVIDER_API_KEY and COPILOT_MODEL. The model must support tool calling and streaming.
Customizing it
Copilot CLI supports custom instructions, MCP servers, custom agents, hooks that run shell commands at points in a session, skills and Copilot Memory. Use /mcp to see configured MCP servers, and /feedback to send GitHub a bug report or suggestion.
Tips
- Start complex tasks in plan mode (Shift+Tab) so you can correct the plan before any code is written.
- Prefer narrow --allow-tool rules over --allow-all-tools, and use --deny-tool, which takes precedence; GitHub’s examples are --deny-tool='shell(rm)' and --deny-tool='shell(git push)'.
- Run /sandbox enable to restrict Copilot’s access to your filesystem, network and system capabilities.
- Prerelease builds install with @github/copilot@prerelease (npm), GitHub.Copilot.Prerelease (WinGet) or copilot-cli@prerelease (Homebrew).
Next steps
Verified MCP servers for Copilot
Generate an MCP config for Copilot
GitHub Copilot hub
Claude Code vs GitHub Copilot: documented features compared
Cursor vs GitHub Copilot: documented features compared
How to add an MCP server to Codex
How to add an MCP server to Cursor
How to add an MCP server to GitHub Copilot in VS Code
How to add an MCP server to Google Antigravity
How to migrate from Gemini CLI to Antigravity CLI
Portable agent skills: one SKILL.md for every coding agent
Safe “always allow” rules for Claude Code and Codex CLI
GitHub Copilot CLI yolo mode: --allow-all and safer tool rules
Codex sandbox modes and approval policies explained
How to install Claude Code on macOS, Linux and Windows
How to install the OpenAI Codex CLI
Claude Code auto mode: what runs, what gets blocked, how to turn it off
Agent Skills moves to the Agentic AI Foundation: what changes
MCP security: the risks in MCP servers and how to lock them down
Claude Code in VS Code: install, shortcuts and CLI differences
What is AGENTS.md? The open instruction file for coding agents
Claude Code on Windows: native, WSL and common errors
Codex skills: create, install and use SKILL.md skills in Codex
Cursor Agent SDK: build, test and deploy agents as code
GPT-6.1 Terra in Codex and the API: setup, pricing and limits
MCP OAuth: connect a remote MCP server in Claude Code, Codex and Cursor
Codex config.toml: location, precedence and the settings to change
Codex on Windows: native sandbox setup, WSL and fixes
Antigravity CLI (agy): install, sign in, modes and commands
Google Antigravity on Windows: install, WSL, sandbox and fixes
GitHub Copilot coding agent (now cloud agent): how to use it
GitHub Copilot agent mode: how to use it in your IDE
GitHub Copilot CLI yolo mode and safer tool rules
How to add an MCP server to GitHub Copilot
GitHub Copilot pricing
GitHub Copilot
Claude Code vs GitHub Copilot
Frequently asked questions
Run npm install -g @github/copilot (Node.js 22+), brew install --cask copilot-cli on macOS or Linux, winget install GitHub.Copilot on Windows, or curl -fsSL https://gh.io/copilot-install | bash.