GitHub Copilot

GitHub Copilot CLI permissions: --allow-tool, --deny-tool, --allow-all-tools and trusted directories

How do I control which tools GitHub Copilot CLI can run without asking?

Use --allow-tool and --deny-tool with shell(COMMAND), write, or an MCP server name, or --allow-all-tools to skip all prompts. --deny-tool always beats the allow options. --allow-all or --yolo turns on all permissions at once.

The approval prompt

The first time Copilot wants a tool that can modify or execute files, it asks:

Prompt options

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 approves that tool with any arguments for the current session only. Approving rm this way lets Copilot run any rm command until the session ends.

Allow and deny flags

  • --allow-all-tools: use any tool without approval.
  • --allow-tool: allow one tool without approval.
  • --deny-tool: block one tool. It takes precedence over both allow options.
  • Arguments: 'shell(COMMAND)', 'shell' for all shell commands, 'write' for non-shell file edits, 'MCP_SERVER_NAME' or 'MCP_SERVER_NAME(tool_name)'.
  • For git and gh you can target a first level subcommand, such as shell(git push).

Allow everything except rm and git push

copilot --allow-all-tools --deny-tool='shell(rm)' --deny-tool='shell(git push)'

Allow one MCP server but block one of its tools

copilot --allow-tool='My-MCP-Server' --deny-tool='My-MCP-Server(tool_name)'

Scripted run allowing only git

copilot -p "Show me this week's commits and summarize them" --allow-tool='shell(git)'

Turn on all permissions

--allow-all or --yolo enables all permissions at once. In an interactive session you can also control tool permissions with slash commands such as /allow-all and /yolo. Run copilot help permissions for details.

Trusted directories

At startup you confirm that you trust the launch folder and everything below it. Do not launch from your home directory. Add another folder during a session with /add-dir.

Inside Copilot CLI

/add-dir /path/to/directory

GitHub says permission scoping is heuristic and does not guarantee files outside trusted directories are protected.

Reduce risk with sandboxing

Enter /sandbox enable to restrict what commands run by Copilot can access on your machine. Or run copilot --cloud to run the whole session in an isolated cloud environment.

Sources

More on GitHub Copilot

Other guides

Cursor: allow all terminal commandsClaude Code: allow commands without promptsCodex CLI: approval and sandbox modesGemini CLI: YOLO mode, auto_edit and allowing specific shell commandsCursor Privacy Mode: telemetry, training and data retentionClaude Code telemetry and data retention: what is sent and how to turn it offGemini CLI: turn off usage statistics and telemetryCLAUDE.md: where it goes, how it loads, and how it works with AGENTS.mdClaude Code hooks: format on save, block risky edits, get notifiedClaude Code subagents: create one, limit its tools, and call itAdd MCP servers to Cursor with mcp.json: Keep files out of Cursor with .cursorignore: Configure Codex with config.toml: Configure Gemini CLI with settings.json: Add MCP servers to Claude Code (claude mcp add, .mcp.json, scopes): Claude Code custom slash commands and skills (SKILL.md): GitHub Copilot custom instructions: Adding MCP servers to GitHub Copilot: Claude Code settings.json: file locations, precedence, and key settingsClaude Code plugins and marketplaces: install, create, and shareGemini CLI extensions and custom commands: Configuring OpenCode with opencode.json: Cline Rules: workspace, global, and conditional rulesKiro steering files: .kiro/steering, inclusion modes, and AGENTS.mdZed agent: instruction files, MCP servers, tool permissions, and ACP agentsCursor CLI: install, headless mode, permissions and CIAider: CONVENTIONS.md, .aider.conf.yml and API keysJunie guidelines, MCP and the Action Allowlist: Amp AGENTS.md, settings.json and MCP: Configure Goose extensions, hints, recipes and permissions: Customize OpenHands with skills, AGENTS.md, setup.sh and MCP: Configure Factory Droid CLI: AGENTS.md, settings.json, autonomy, custom droids and MCPConfigure Qwen Code: settings.json, providers, QWEN.md, MCP and approval modesCursor hooks: hooks.json, beforeShellExecution, afterFileEdit and exit codesCursor sandbox: sandbox.json, network allowlist and run modesCursor settings: settings.json, Cursor Settings and the ~/.cursor config filesCursor browser agent: @browser, browser automation and approval modesCursor subagents: .cursor/agents, frontmatter, built-in Explore, Bash and BrowserCursor telemetry and OpenTelemetry export (Privacy Mode, OTLP, Analytics API): Cursor rules setup: .cursor/rules, .mdc frontmatter, globs, alwaysApply and AGENTS.mdClaude Code headless mode: claude -p, --output-format json, --bare and CI flagsClaude Code statusline: custom status bar in settings.json with context %, cost and git branchClaude Code /model: switch models, aliasesClaude Code /cost and /usage: check token spend, usage limits and reduce costsClaude Code VS Code extension: install, shortcuts, settings and /ideCodex AGENTS.md: global, project and override instruction files explainedCodex MCP servers: codex mcp add and [mcp_servers] in config.tomlCodex sandbox modes: read-only, workspace-write, danger-full-access and network accesscodex exec: run Codex non-interactively in scripts and CI with JSON outputCodex skills: create SKILL.md, skill folder locations and $skill invocationGEMINI.md in Gemini CLI: context file locations, imports and /memoryGemini CLI MCP servers: gemini mcp add and mcpServers in settings.jsonGemini CLI custom slash commands: TOML files, {{args}}, !{shell} and @{file}Gemini CLI headless mode: gemini -p, JSON output and exit codes for scripts and CIGemini CLI sandbox: enable Docker, Podman, macOS Seatbelt or gVisorcopilot-setup-steps.yml: set up the GitHub Copilot cloudGitHub Copilot custom agents: .github/agents/*.agent.md profiles, tools and frontmatterGitHub Copilot code review settings: automatic PR reviews, rulesets, effort level and approvals

Get the weekly agent stack update

New official MCP servers, spec changes and harness releases, checked against the source. One email a week, no fluff.

Reviewed Oct 13, 2026. Settings change often; the linked vendor docs are the source of truth.