Copilot CLI: Permissions, Config, Trusted Folders, and Environment Variables

Commands and JSON snippets for Copilot CLI permissions, tool access, trusted directories, environment variables, and persistent configuration.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Permissions, tools, paths, and URLs
Allow all tools, paths, and URLs
copilot --allow-all -p "Audit this repository and propose improvements."

# Disable approval prompts for the whole run.

Allow all tools automatically
copilot --allow-all-tools -p "Run tests and fix the simplest failing case."

# Skip confirmation for tool use.

Add an allowed directory
copilot --add-dir=../shared-lib -p "Inspect both repositories and suggest shared abstractions."

# Grant file access to an extra path.

Allow specific shell commands only
copilot --allow-tool="shell(git:*)" -p "Summarize branch divergence and recent merge risks."

# Permit a narrow shell tool pattern.

Deny a dangerous shell action
copilot --allow-tool="shell(git:*)" --deny-tool="shell(git push)"

# Block a specific command even when a broader rule allows related commands.

Allow a specific domain
copilot --allow-url=docs.github.com -p "Read the docs and summarize the CLI auth flow."

# Trust a URL or domain without prompts.

Block a specific URL or domain
copilot --deny-url=example.com -p "Do the task without consulting blocked domains."

# Prevent access to sites you do not want queried.

## Environment variables and common options
Set the model for a session
export COPILOT_MODEL="MODEL_NAME"

# Choose a model using an environment variable.

Allow all permissions via environment variable
export COPILOT_ALLOW_ALL=true

# Enable fully automatic permissions in scripts.

Choose the editor for prompt editing
export COPILOT_EDITOR="code --wait"

# Set the editor Copilot should use.

Authenticate with a token environment variable
export COPILOT_GITHUB_TOKEN=YOUR_FINE_GRAINED_TOKEN

# Set a token for non-interactive environments.

Override the Copilot home directory
export COPILOT_HOME="$HOME/.copilot-work"

# Change where config and state files are stored.

Disable automatic updates
export COPILOT_AUTO_UPDATE=false

# Prevent background auto-updates.

Disable rich diff rendering
export PLAIN_DIFF=true

# Use plain-text diff output.

## Config files and trusted-folder layout
Open the global user config path
~/.copilot/config.json

# Use the default config location.

Repository-shared settings path
.github/copilot/settings.json

# Commit repo-wide Copilot settings.

Personal local overrides path
.github/copilot/settings.local.json

# Create non-committed per-repo overrides.

Store permanently trusted folders
{
  "trusted_folders": [
    "/Users/you/src/project-a",
    "/Users/you/src/project-b"
  ]
}

# Persist trusted directories in the user config.

Disable the animated banner
{
  "banner": "never"
}

# Tune a simple UI preference in config.

Disable auto update in config
{
  "auto_update": false
}

# Persist no-auto-update behavior.

Recommended next

No recommendations yet.