Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Cheat sheet

GitHub Copilot CLI cheat sheet

GitHub Copilot CLI slash commands, flags, keyboard shortcuts, permission rules and file locations on one page, checked against copilot --help and GitHub's docs.

By Checked Intermediate
Bookmark

Bookmarks are kept in your free account, so you can find this page again on any device.

Sign in to bookmark
On this page

The commands, flags, keys and file paths for GitHub Copilot CLI (the copilot command), checked against copilot --help for version 1.0.114 and GitHub’s docs on 21 November 2026. Start with copilot in your repository, run /init once, and press Shift+Tab to plan before large changes.

Install and start

# Install (pick one). npm needs Node.js 22 or later
npm install -g @github/copilot
brew install --cask copilot-cli
winget install GitHub.Copilot
curl -fsSL https://gh.io/copilot-install | bash

# Sign in, then start in your project folder
copilot login
copilot

You need an active GitHub Copilot subscription, and an organisation can turn the CLI off for its members. Classic ghp_ personal access tokens do not work; use copilot login or a fine-grained token with the “Copilot Requests” permission.

Slash commands you will use most

Command What it does
/init Write .github/copilot-instructions.md for this repository
/plan Create an implementation plan before coding
/model Pick the model for this session (auto lets Copilot choose)
/diff Review the changes made in the current directory
/review Run the code review agent on your changes
/security-review Scan uncommitted changes, or the branch diff, for vulnerabilities
/rewind Go back to an earlier turn, optionally restoring files (cannot be undone)
/permissions Switch permission mode
/context Show context window usage
/compact Summarise the conversation to free context
/usage Session usage and statistics
/clear, /new Abandon this session, or start a new conversation
/resume Switch to another session by ID, task ID or name
/delegate Hand the session to GitHub, which opens a pull request
/mcp, /skills, /agent, /plugin Manage MCP servers, skills, custom agents and plugins
/instructions View and toggle instruction files
/add-dir Allow access to another directory
/env Show what loaded: instructions, MCP servers, skills, agents, hooks
/help List every command

Run copilot help commands for the full list; version 1.0.114 lists 77.

Command-line flags

Flag What it does
-p, --prompt "<text>" Run one prompt without the interactive UI, then exit
-i, --interactive "<text>" Start interactive mode and run this prompt first
-s, --silent Print only the agent’s answer (for scripts with -p)
--output-format json JSONL output, one object per line
--continue Resume the most recent session
-r, --resume [<id-or-name>] Resume a session; without a value, opens a picker
--model <model> Choose the model
--plan, --mode <mode> Start in plan mode, or in interactive, plan or autopilot
--allow-tool '<rule>' Pre-approve tools for this run, e.g. 'shell(npm:*)' or 'write'
--deny-tool '<rule>' Block tools; deny rules win over every allow
--allow-all-tools Run every tool without asking
--allow-all, --yolo Allow all tools, paths and URLs
--add-dir <directory> Allow access to another directory
--allow-url <domain>, --deny-url <domain> Allow or block web access per domain
--no-custom-instructions Ignore AGENTS.md and other instruction files
--secret-env-vars=<VAR,VAR> Remove these variables from shell and MCP server environments
--share [<path>] Save the session to Markdown after a -p run

Permission rules

# Allow every git command except git push
copilot --allow-tool='shell(git:*)' --deny-tool='shell(git push)'

# Allow file edits, but never to .env files in any folder
copilot --allow-tool='write' --deny-tool='write(.env)'

# Script a task with tool use pre-approved (non-interactive runs cannot ask)
copilot -p "Fix the failing test in src/date.test.ts" --allow-tool='shell(npm:*)' --allow-tool='write'

Only the first subcommand is part of a shell rule’s name, so shell(gh pr) also allows gh pr merge. Answering “Yes, and don’t ask again” saves the approval for that repository in ~/.copilot/permissions-config.json; /reset-allowed-tools clears it.

Keyboard shortcuts

Key What it does
Shift+Tab Cycle standard, plan and autopilot mode
@ then a file name Add a file to the context
! then a command Run a shell command yourself, without the agent
Esc Cancel; press twice to interrupt the running turn
Ctrl+C Cancel or clear input; twice on an empty prompt to quit
Ctrl+D Quit
Ctrl+Q (or Ctrl+Enter) Queue a message while the agent is busy
Shift+Enter, Alt+Enter or Ctrl+J New line
Ctrl+G Edit the prompt in your $EDITOR
Ctrl+R Search earlier prompts
? on an empty prompt Quick help

If Shift+Enter sends instead of adding a line in VS Code, Cursor or Windows Terminal, run /terminal-setup. Shortcuts cannot be rebound.

Files and folders

What Where
Repository instructions .github/copilot-instructions.md
Path-specific instructions .github/instructions/**/*.instructions.md
Agent instruction files also read AGENTS.md, CLAUDE.md (and .claude/CLAUDE.md), GEMINI.md
Personal instructions ~/.copilot/copilot-instructions.md, ~/.copilot/instructions/**/*.instructions.md
User settings ~/.copilot/settings.json
Repository settings .github/copilot/settings.json, .github/copilot/settings.local.json
MCP servers ~/.copilot/mcp-config.json (user), .mcp.json or .github/mcp.json (workspace)
Skills .github/skills/, .agents/skills/ or .claude/skills/; personal ~/.copilot/skills/ or ~/.agents/skills/
Logs ~/.copilot/logs/

Set COPILOT_HOME to move everything under ~/.copilot elsewhere. For headless runs, Copilot reads a token from COPILOT_GITHUB_TOKEN, then GH_TOKEN, then GITHUB_TOKEN.

Management subcommands

# MCP servers: local (stdio) and remote (HTTP)
copilot mcp add notes -- npx tsx /abs/path/server.ts
copilot mcp add --transport http sentry https://mcp.sentry.dev/mcp
copilot mcp list

# Skills and plugins
copilot skill list
copilot plugin marketplace browse awesome-copilot

# Settings, using dot notation for nested keys
copilot config --list
copilot config allowedUrls github.com

# What instructions would load here
copilot instruction list

Common mistakes

Mistake Fix
copilot -p stops with tools denied Non-interactive runs cannot ask; add --allow-tool rules for what the task needs
Allowed shell(gh pr) to let it open pull requests It also allows gh pr merge and gh pr close; approve those prompts one at a time instead
--yolo on your main machine Use it only in a container or VM; prefer narrow --allow-tool rules
Login fails with a ghp_ token Use copilot login or a fine-grained token with “Copilot Requests”
Installing with npm on an old Node.js The npm package needs Node.js 22 or later; otherwise use Homebrew, WinGet or the install script

Check your setup

copilot --version
copilot instruction list
copilot mcp list
copilot -p "List the files in this folder" -s

For skills in Copilot, see GitHub Copilot skills and the gh skill command. The same page for the other agents is the Claude Code cheat sheet and the Codex CLI cheat sheet; the coding agent cheat sheet puts them side by side. To see how the three compare on one task, read Claude Code vs Codex vs Cursor.

Check your understanding

GitHub Copilot CLI quiz

Installing Copilot CLI, slash commands, scripting flags, permission rules, keyboard shortcuts and where its files live.

7 questions · pass mark 70%

Question 1 of 70 answered
  1. Copilot CLI refuses to sign in with your token. Which token type is not supported?

Checked against

Back to top