Skip to main content

GitHub Copilot CLI command reference

Find commands and keyboard shortcuts to help you use Copilot CLI effectively.

Command-line commands

CommandPurpose
copilotLaunch the interactive user interface.
copilot help [topic]Display help information. Help topics include: config, commands, environment, logging, and permissions.
copilot initInitialize Copilot custom instructions for this repository.
copilot updateDownload and install the latest version.
copilot versionDisplay version information and check for updates.
copilot loginAuthenticate with Copilot via the OAuth device flow. Accepts --host HOST to specify the GitHub host URL (default: https://github.com).
copilot logoutSign out of GitHub and remove stored credentials.
copilot pluginManage plugins and plugin marketplaces.

Global shortcuts in the interactive interface

ShortcutPurpose
@ FILENAMEInclude file contents in the context.
Ctrl+X then /After you have started typing a prompt, this allows you to run a slash command—for example, if you want to change the model without having to retype your prompt.
EscCancel the current operation.
! COMMANDExecute a command in your local shell, bypassing Copilot.
Ctrl+CCancel operation / clear input. Press twice to exit.
Ctrl+DShutdown.
Ctrl+LClear the screen.
Shift+TabCycle between standard, plan, and autopilot mode.

Timeline shortcuts in the interactive interface

ShortcutPurpose
ctrl+oWhile there is nothing in the prompt input, this expands recent items in Copilot's response timeline to show more details.
ctrl+eWhile there is nothing in the prompt input, this expands all items in Copilot's response timeline.
ctrl+tExpand/collapse display of reasoning in responses.
ShortcutPurpose
Ctrl+AMove to beginning of the line (when typing).
Ctrl+BMove to the previous character.
Ctrl+EMove to end of the line (when typing).
Ctrl+FMove to the next character.
Ctrl+HDelete the previous character.
Ctrl+KDelete from cursor to end of the line.
Ctrl+UDelete from cursor to beginning of the line.
Ctrl+WDelete the previous word.
HomeMove to the start of the current line.
EndMove to the end of the current line.
Ctrl+HomeMove to the start of the text.
Ctrl+EndMove to the end of the text.
Meta+/Move the cursor by a word.
/Navigate the command history.

Slash commands in the interactive interface

CommandPurpose
/add-dir PATHAdd a directory to the allowed list for file access.
/agentBrowse and select from available agents (if any).
/allow-all, /yoloEnable all permissions (tools, paths, and URLs).
/clear, /newClear the conversation history.
/compactSummarize the conversation history to reduce context window usage.
/contextShow the context window token usage and visualization.
/cwd, /cd [PATH]Change the working directory or display the current directory.
/delegate [PROMPT]Delegate changes to a remote repository with an AI-generated pull request.
/diffReview the changes made in the current directory.
/exit, /quitExit the CLI.
/experimental [on|off]Toggle or turn on/off experimental features.
/feedbackProvide feedback about the CLI.
/fleet [PROMPT]Enable parallel subagent execution of parts of a task. See Running tasks in parallel with the /fleet command.
/helpShow the help for interactive commands.
/ideConnect to an IDE workspace.
/initInitialize Copilot custom instructions and agentic features for this repository.
/list-dirsDisplay all of the directories for which file access has been allowed.
/loginLog in to Copilot.
/logoutLog out of Copilot.
/lsp [show|test|reload|help] [SERVER-NAME]Manage the language server configuration.
/mcp [show|add|edit|delete|disable|enable] [SERVER-NAME]Manage the MCP server configuration.
/model, /models [MODEL]Select the AI model you want to use.
/plan [PROMPT]Create an implementation plan before coding.
/plugin [marketplace|install|uninstall|update|list] [ARGS...]Manage plugins and plugin marketplaces.
/rename NAMERename the current session (alias for /session rename).
/reset-allowed-toolsReset the list of allowed tools.
/resume [SESSION-ID]Switch to a different session by choosing from a list (optionally specify a session ID).
/review [PROMPT]Run the code review agent to analyze changes.
/session [checkpoints [n]|files|plan|rename NAME]Show session information and a workspace summary. Use the subcommands for details.
/share [file|gist] [PATH]Share the session to a Markdown file or GitHub gist.
/skills [list|info|add|remove|reload] [ARGS...]Manage skills for enhanced capabilities.
/terminal-setupConfigure the terminal for multiline input support (Shift+Enter and Ctrl+Enter).
/theme [show|set|list] [auto|THEME-ID]View or configure the terminal theme.
/usageDisplay session usage metrics and statistics.
/user [show|list|switch]Manage the current GitHub user.

For a complete list of available slash commands enter /help in the CLI's interactive interface.

Command-line options

OptionPurpose
--acpStart the Agent Client Protocol server.
--add-dir PATHAdd a directory to the allowed list for file access (can be used multiple times).
--add-github-mcp-tool TOOLAdd a tool to enable for the GitHub MCP server, instead of the default CLI subset (can be used multiple times). Use * for all tools.
--add-github-mcp-toolset TOOLSETAdd a toolset to enable for the GitHub MCP server, instead of the default CLI subset (can be used multiple times). Use all for all toolsets.
--additional-mcp-config JSONAdd an MCP server for this session only. The server configuration can be supplied as a JSON string or a file path (prefix with @). Augments the configuration from ~/.copilot/mcp-config.json. Overrides any installed MCP server configuration with the same name.
--agent AGENTSpecify a custom agent to use.
--allow-allEnable all permissions (equivalent to --allow-all-tools --allow-all-paths --allow-all-urls).
--allow-all-pathsDisable file path verification and allow access to any path.
--allow-all-toolsAllow all tools to run automatically without confirmation. Required when using the CLI programmatically (env: COPILOT_ALLOW_ALL).
--allow-all-urlsAllow access to all URLs without confirmation.
--allow-tool [TOOLS...]Tools the CLI has permission to use. Will not prompt for permission.
--allow-url [URLS...]Allow access to specific URLs or domains.
--alt-screen [VALUE]Use the terminal alternate screen buffer (on or off).
--autopilotEnable autopilot continuation in prompt mode. See Allowing GitHub Copilot CLI to work autonomously.
--available-tools [TOOLS...]Only these tools will be available to the model.
--bannerShow the startup banner.
--bash-env [VALUE]Enable BASH_ENV support for bash shells (on or off).
--config-dir PATHSet the configuration directory (default: ~/.copilot).
--continueResume the most recent session.
--deny-tool [TOOLS...]Tools the CLI does not have permission to use. Will not prompt for permission.
--deny-url [URLS...]Deny access to specific URLs or domains, takes precedence over --allow-url.
--disable-builtin-mcpsDisable all built-in MCP servers (currently: github-mcp-server).
--disable-mcp-server SERVER-NAMEDisable a specific MCP server (can be used multiple times).
--disable-parallel-tools-executionDisable parallel execution of tools (LLM can still make parallel tool calls, but they will be executed sequentially).
--disallow-temp-dirPrevent automatic access to the system temporary directory.
--enable-all-github-mcp-toolsEnable all GitHub MCP server tools, instead of the default CLI subset. Overrides the --add-github-mcp-toolset and --add-github-mcp-tool options.
--excluded-tools [TOOLS...]These tools will not be available to the model.
--experimentalEnable experimental features (use --no-experimental to disable).
-h, --helpDisplay help.
-i PROMPT, --interactive PROMPTStart an interactive session and automatically execute this prompt.
--log-dir DIRECTORYSet the log file directory (default: ~/.copilot/logs/).
--log-level LEVELSet the log level (choices: none, error, warning, info, debug, all, default).
--max-autopilot-continues COUNTMaximum number of continuation messages in autopilot mode (default: unlimited). See Allowing GitHub Copilot CLI to work autonomously.
--model MODELSet the AI model you want to use.
--no-alt-screenDisable the terminal alternate screen buffer.
--no-ask-userDisable the ask_user tool (the agent works autonomously without asking questions).
--no-auto-updateDisable downloading CLI updates automatically.
--no-bash-envDisable BASH_ENV support for bash shells.
--no-colorDisable all color output.
--no-custom-instructionsDisable loading of custom instructions from AGENTS.md and related files.
--no-experimentalDisable experimental features.
-p PROMPT, --prompt PROMPTExecute a prompt programmatically (exits after completion).
--plain-diffDisable rich diff rendering (syntax highlighting via the diff tool specified by your git config).
--resume [SESSION-ID]Resume a previous interactive session by choosing from a list (optionally specify a session ID).
-s, --silentOutput only the agent response (without usage statistics), useful for scripting with -p.
--screen-readerEnable screen reader optimizations.
--share [PATH]Share a session to a Markdown file after completion of a programmatic session (default path: ./copilot-session-<ID>.md).
--share-gistShare a session to a secret GitHub gist after completion of a programmatic session.
--stream MODEEnable or disable streaming mode (mode choices: on or off).
-v, --versionShow version information.
--yoloEnable all permissions (equivalent to --allow-all).

For a complete list of commands and options, run copilot help.

Tool permission patterns

The --allow-tool and --deny-tool options accept permission patterns in the format Kind(argument). The argument is optional—omitting it matches all tools of that kind.

KindDescriptionExample patterns
shellShell command executionshell(git push), shell(git:*), shell
writeFile creation or modificationwrite, write(src/*.ts)
readFile or directory readsread, read(.env)
SERVER-NAMEMCP server tool invocationMyMCP(create_issue), MyMCP
urlURL access via web-fetch or shellurl(github.com), url(https://*.api.com)
memoryStoring facts to agent memorymemory

For shell rules, the :* suffix matches the command stem followed by a space, preventing partial matches. For example, shell(git:*) matches git push and git pull but does not match gitea.

Deny rules always take precedence over allow rules, even when --allow-all is set.

# Allow all git commands except git push
copilot --allow-tool 'shell(git:*)' --deny-tool 'shell(git push)'

# Allow a specific MCP server tool
copilot --allow-tool 'MyMCP(create_issue)'

# Allow all tools from a server
copilot --allow-tool 'MyMCP'

Environment variables

VariableDescription
COPILOT_MODELSet the AI model.
COPILOT_ALLOW_ALLSet to true to allow all permissions automatically (equivalent to --allow-all).
COPILOT_AUTO_UPDATESet to false to disable automatic updates.
COPILOT_CUSTOM_INSTRUCTIONS_DIRSComma-separated list of additional directories for custom instructions.
COPILOT_SKILLS_DIRSComma-separated list of additional directories for skills.
COPILOT_EDITOREditor command for interactive editing (checked after $VISUAL and $EDITOR). Defaults to vi if none are set.
COPILOT_GITHUB_TOKENAuthentication token. Takes precedence over GH_TOKEN and GITHUB_TOKEN.
GH_TOKENAuthentication token. Takes precedence over GITHUB_TOKEN.
GITHUB_TOKENAuthentication token.
XDG_CONFIG_HOMEOverride the configuration directory. Default: $HOME/.copilot.
XDG_STATE_HOMEOverride the state directory. Default: $HOME/.copilot.
USE_BUILTIN_RIPGREPSet to false to use the system ripgrep instead of the bundled version.
PLAIN_DIFFSet to true to disable rich diff rendering.
COLORFGBGFallback for dark/light terminal background detection.
COPILOT_CLI_ENABLED_FEATURE_FLAGSComma-separated list of feature flags to enable (for example, "SOME_FEATURE,SOME_OTHER_FEATURE").

Configuration file settings

User settings are stored in ~/.copilot/config.json. Project-level settings can be placed in .copilot/settings.json (committed to the repository) or .copilot/settings.local.json (personal overrides—add to .gitignore). Settings cascade from user to project to local, with more specific scopes overriding more general ones. Command-line flags and environment variables always take the highest precedence.

KeyTypeDefaultDescription
allowed_urlsstring[][]URLs or domains allowed without prompting.
alt_screenbooleanfalseUse the terminal alternate screen buffer.
auto_updatebooleantrueAutomatically download CLI updates.
banner"always" | "once" | "never""once"Animated banner display frequency.
bash_envbooleanfalseEnable BASH_ENV support for bash shells.
beepbooleantruePlay an audible beep when attention is required.
compact_pastebooleantrueCollapse large pastes into compact tokens.
custom_agents.default_local_onlybooleanfalseOnly use local custom agents.
denied_urlsstring[][]URLs or domains blocked (takes precedence over allowed_urls).
experimentalbooleanfalseEnable experimental features.
include_coauthorbooleantrueAdd a Co-authored-by trailer to git commits made by the agent.
launch_messagesstring[][]Custom messages shown randomly on startup.
log_level"none" | "error" | "warning" | "info" | "debug" | "all" | "default""default"Logging verbosity.
modelstringvariesAI model to use (see the /model command).
reasoning_effort"low" | "medium" | "high" | "xhigh""medium"Reasoning effort level for extended thinking. Higher levels use more compute.
render_markdownbooleantrueRender Markdown in terminal output.
screen_readerbooleanfalseEnable screen reader optimizations.
streambooleantrueEnable streaming responses.
store_token_plaintextbooleanfalseStore authentication tokens in plaintext in the config file when no system keychain is available.
streamer_modebooleanfalseHide preview model names and quota details (useful when recording).
theme"auto" | "dark" | "light""auto"Terminal color theme.
trusted_foldersstring[][]Folders with pre-granted file access.
update_terminal_titlebooleantrueShow the current intent in the terminal title.

Hooks reference

Hooks are external commands that execute at specific lifecycle points during a session, enabling custom automation, security controls, and integrations. Hook configuration files are loaded automatically from .github/hooks/*.json in your repository.

Hook configuration format

Hook configuration files use JSON format with version 1:

{
  "version": 1,
  "hooks": {
    "preToolUse": [
      {
        "type": "command",
        "bash": "your-bash-command",
        "powershell": "your-powershell-command",
        "cwd": "optional/working/directory",
        "env": { "VAR": "value" },
        "timeoutSec": 30
      }
    ]
  }
}
FieldTypeRequiredDescription
type"command"YesMust be "command".
bashstringOne of bash/powershellShell command for Unix.
powershellstringOne of bash/powershellShell command for Windows.
cwdstringNoWorking directory for the command (relative to repository root or absolute).
envobjectNoEnvironment variables to set (supports variable expansion).
timeoutSecnumberNoTimeout in seconds. Default: 30.

Hook events

EventFires whenOutput processed
sessionStartA new or resumed session begins.No
sessionEndThe session terminates.No
userPromptSubmittedThe user submits a prompt.No
preToolUseBefore each tool executes.Yes — can allow, deny, or modify.
postToolUseAfter each tool completes.No
agentStopThe main agent finishes a turn.Yes — can block and force continuation.
subagentStopA subagent completes.Yes — can block and force continuation.
errorOccurredAn error occurs during execution.No

preToolUse decision control

The preToolUse hook can control tool execution by writing a JSON object to stdout.

FieldValuesDescription
permissionDecision"allow", "deny", "ask"Whether the tool executes. Empty output uses default behavior.
permissionDecisionReasonstringReason shown to the agent. Required when decision is "deny".
modifiedArgsobjectSubstitute tool arguments to use instead of the originals.

agentStop / subagentStop decision control

FieldValuesDescription
decision"block", "allow""block" forces another agent turn using reason as the prompt.
reasonstringPrompt for the next turn when decision is "block".

Tool names for hook matching

Tool nameDescription
bashExecute shell commands (Unix).
powershellExecute shell commands (Windows).
viewRead file contents.
editModify file contents.
createCreate new files.
globFind files by pattern.
grepSearch file contents.
web_fetchFetch web pages.
taskRun subagent tasks.

If multiple hooks of the same type are configured, they execute in order. For preToolUse, if any hook returns "deny", the tool is blocked. Hook failures (non-zero exit codes or timeouts) are logged and skipped—they never block agent execution.

MCP server configuration

MCP servers provide additional tools to the CLI agent. Configure persistent servers in ~/.copilot/mcp-config.json. Use --additional-mcp-config to add servers for a single session.

Transport types

TypeDescriptionRequired fields
local / stdioLocal process communicating via stdin/stdout.command, args
httpRemote server using streamable HTTP transport.url
sseRemote server using Server-Sent Events transport.url

Local server configuration fields

FieldRequiredDescription
commandYesCommand to start the server.
argsYesCommand arguments (array).
toolsYesTools to enable: ["*"] for all, or a list of specific tool names.
envNoEnvironment variables. Supports $VAR, ${VAR}, and ${VAR:-default} expansion.
cwdNoWorking directory for the server.
timeoutNoTool call timeout in milliseconds.
typeNo"local" or "stdio". Default: "local".

Remote server configuration fields

FieldRequiredDescription
typeYes"http" or "sse".
urlYesServer URL.
toolsYesTools to enable.
headersNoHTTP headers. Supports variable expansion.
oauthClientIdNoStatic OAuth client ID (skips dynamic registration).
oauthPublicClientNoWhether the OAuth client is public. Default: true.
timeoutNoTool call timeout in milliseconds.

Filter mapping

Control how MCP tool output is processed using the filterMapping field in a server's configuration.

ModeDescription
noneNo filtering.
markdownFormat output as Markdown.
hidden_charactersRemove hidden or control characters. Default.

Built-in MCP servers

The CLI includes built-in MCP servers that are available without additional setup.

ServerDescription
github-mcp-serverGitHub API integration: issues, pull requests, commits, code search, and GitHub Actions.
playwrightBrowser automation: navigate, click, type, screenshot, and form handling.
fetchHTTP requests via the fetch tool.
timeTime utilities: get_current_time and convert_time.

Use --disable-builtin-mcps to disable all built-in servers, or --disable-mcp-server SERVER-NAME to disable a specific one.

Skills reference

Skills are Markdown files that extend what the CLI can do. Each skill lives in its own directory containing a SKILL.md file. When invoked (via /SKILL-NAME or automatically by the agent), the skill's content is injected into the conversation.

Skill frontmatter fields

FieldTypeRequiredDescription
namestringYesUnique identifier for the skill. Letters, numbers, and hyphens only. Max 64 characters.
descriptionstringYesWhat the skill does and when to use it. Max 1024 characters.
allowed-toolsstring or string[]NoComma-separated list or YAML array of tools that are automatically allowed when the skill is active. Use "*" for all tools.
user-invocablebooleanNoWhether users can invoke the skill with /SKILL-NAME. Default: true.
disable-model-invocationbooleanNoPrevent the agent from automatically invoking this skill. Default: false.

Skill locations

Skills are loaded from these locations in priority order (first found wins for duplicate names).

LocationScopeDescription
.github/skills/ProjectProject-specific skills.
.agents/skills/ProjectAlternative project location.
.claude/skills/ProjectClaude-compatible location.
Parent .github/skills/InheritedMonorepo parent directory support.
~/.copilot/skills/PersonalPersonal skills for all projects.
~/.claude/skills/PersonalClaude-compatible personal location.
Plugin directoriesPluginSkills from installed plugins.
COPILOT_SKILLS_DIRSCustomAdditional directories (comma-separated).

Commands (alternative skill format)

Commands are an alternative to skills stored as individual .md files in .claude/commands/. The command name is derived from the filename. Command files use a simplified format (no name field required) and support description, allowed-tools, and disable-model-invocation. Commands have lower priority than skills with the same name.

Custom agents reference

Custom agents are specialized AI agents defined in Markdown files. The filename (minus extension) becomes the agent ID. Use .agent.md or .md as the file extension.

Built-in agents

AgentDefault modelDescription
exploreclaude-haiku-4.5Fast codebase exploration. Searches files, reads code, and answers questions. Returns focused answers under 300 words. Safe to run in parallel.
taskclaude-haiku-4.5Command execution (tests, builds, lints). Returns brief summary on success, full output on failure.
code-reviewclaude-sonnet-4.5High signal-to-noise code review. Analyzes diffs for bugs, security issues, and logic errors.
general-purposeclaude-sonnet-4.5Full-capability agent for complex multi-step tasks. Runs in a separate context window.

Custom agent frontmatter fields

FieldTypeRequiredDescription
namestringNoDisplay name. Defaults to the filename.
descriptionstringYesDescription shown in the agent list and task tool.
modelstringNoAI model for this agent. When unset, inherits the outer agent's model.
toolsstring[]NoTools available to the agent. Default: ["*"] (all tools).
mcp-serversobjectNoMCP servers to connect. Uses the same schema as ~/.copilot/mcp-config.json.
inferbooleanNoAllow auto-delegation by the main agent. Default: true.

Custom agent locations

ScopeLocation
Project.github/agents/ or .claude/agents/
User~/.copilot/agents/ or ~/.claude/agents/
Plugin<plugin>/agents/

Project-level agents take precedence over user-level agents. Plugin agents have the lowest priority.

Permission approval responses

When the CLI prompts for permission to execute an operation, you can respond with the following keys.

KeyEffect
yAllow this specific request once.
nDeny this specific request once.
!Allow all similar requests for the rest of the session.
#Deny all similar requests for the rest of the session.
?Show detailed information about the request.

Session approvals reset when you run /clear or start a new session.

FlagTierDescription
AUTOPILOT_MODEexperimentalAutonomous operation mode.
BACKGROUND_AGENTSstaffRun agents in the background.
QUEUED_COMMANDSstaffQueue commands while the agent is running.
LSP_TOOLSonLanguage Server Protocol tools.
PLAN_COMMANDonInteractive planning mode.
AGENTIC_MEMORYonPersistent memory across sessions.
CUSTOM_AGENTSonCustom agent definitions.