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

Control what Copilot can read, modify, execute, and call automatically.

Allow all tools, paths, and URLs

Disable approval prompts for the whole run.

bashANYcopilotpermissionsallow-all
bash
copilot --allow-all -p "Audit this repository and propose improvements."
Notes

This is powerful but high trust. Use only in safe environments.

Allow all tools automatically

Skip confirmation for tool use.

bashANYcopilotpermissionstools
bash
copilot --allow-all-tools -p "Run tests and fix the simplest failing case."
Notes

This is required for many programmatic automation flows.

Add an allowed directory

Grant file access to an extra path.

bashANYcopilotpermissionspaths
bash
copilot --add-dir=../shared-lib -p "Inspect both repositories and suggest shared abstractions."
Notes

Useful when your working context spans multiple sibling directories.

Allow specific shell commands only

Permit a narrow shell tool pattern.

bashANYcopilotpermissionsshellgit
bash
copilot --allow-tool="shell(git:*)" -p "Summarize branch divergence and recent merge risks."
Notes

A safer way to let Copilot use Git commands without opening everything.

Deny a dangerous shell action

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

bashANYcopilotpermissionsdenygit
bash
copilot --allow-tool="shell(git:*)" --deny-tool="shell(git push)"
Notes

Deny rules take precedence over allow rules, which is ideal for guardrails.

Allow a specific domain

Trust a URL or domain without prompts.

bashANYcopilotpermissionsurl
bash
copilot --allow-url=docs.github.com -p "Read the docs and summarize the CLI auth flow."
Notes

Useful when you want the agent to consult a fixed documentation source.

Block a specific URL or domain

Prevent access to sites you do not want queried.

bashANYcopilotpermissionsdeny-url
bash
copilot --deny-url=example.com -p "Do the task without consulting blocked domains."
Notes

Deny URL rules override allow URL rules.

Environment variables and common options

Set models, editors, tokens, and session-level behavior.

Set the model for a session

Choose a model using an environment variable.

bashANYcopilotenvmodel
bash
export COPILOT_MODEL="MODEL_NAME"
Notes

Model identifiers evolve, so use the names accepted by your installed CLI version.

Allow all permissions via environment variable

Enable fully automatic permissions in scripts.

bashANYcopilotenvpermissions
bash
export COPILOT_ALLOW_ALL=true
Notes

Equivalent to `--allow-all`, often used in automation contexts.

Choose the editor for prompt editing

Set the editor Copilot should use.

bashANYcopilotenveditor
bash
export COPILOT_EDITOR="code --wait"
Notes

Checked after `$VISUAL` and `$EDITOR`, with `vi` as the fallback.

Authenticate with a token environment variable

Set a token for non-interactive environments.

bashANYcopilotenvtokenauth
bash
export COPILOT_GITHUB_TOKEN=YOUR_FINE_GRAINED_TOKEN
Notes

This takes precedence over `GH_TOKEN` and `GITHUB_TOKEN`.

Override the Copilot home directory

Change where config and state files are stored.

bashANYcopilotenvconfig
bash
export COPILOT_HOME="$HOME/.copilot-work"
Notes

Useful when you want separate config profiles or sandboxed environments.

Disable automatic updates

Prevent background auto-updates.

bashANYcopilotenvupdates
bash
export COPILOT_AUTO_UPDATE=false
Notes

Helpful for deterministic CI and reproducible support debugging.

Disable rich diff rendering

Use plain-text diff output.

bashANYcopilotenvdiff
bash
export PLAIN_DIFF=true
Notes

Can be easier to parse in scripts or limited terminal environments.

Config files and trusted-folder layout

Persist defaults globally, per repository, or locally.

Open the global user config path

Use the default config location.

bashANYcopilotconfigpath
bash
~/.copilot/config.json
Notes

This stores user-level defaults for all repositories unless `COPILOT_HOME` overrides it.

Repository-shared settings path

Commit repo-wide Copilot settings.

jsonANYcopilotconfigrepository
json
.github/copilot/settings.json
Notes

Use this for shared team defaults that belong in version control.

Personal local overrides path

Create non-committed per-repo overrides.

jsonANYcopilotconfiglocal
json
.github/copilot/settings.local.json
Notes

Add this file to `.gitignore` to keep personal overrides out of the repo.

Store permanently trusted folders

Persist trusted directories in the user config.

jsonANYcopilotconfigtrusted-folders
json
{
  "trusted_folders": [
    "/Users/you/src/project-a",
    "/Users/you/src/project-b"
  ]
}
Notes

Trusted folders control where Copilot can read, modify, and execute files without re-prompting each time.

Disable the animated banner

Tune a simple UI preference in config.

jsonANYcopilotconfigui
json
{
  "banner": "never"
}
Notes

`banner` supports `always`, `once`, or `never`.

Disable auto update in config

Persist no-auto-update behavior.

jsonANYcopilotconfigupdates
json
{
  "auto_update": false
}
Notes

Use config instead of an environment variable when you want a stable default on a machine.

Recommended next

No recommendations yet.