Copilot CLI: Permissions, Config, Trusted Folders, and Environment Variables/Authenticate with a token environment variable
Set a token for non-interactive environments.
Section: Environment variables and common options
Authenticate with a token environment variable
bash
bash
export COPILOT_GITHUB_TOKEN=YOUR_FINE_GRAINED_TOKENExplanation
This takes precedence over `GH_TOKEN` and `GITHUB_TOKEN`.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Environment variables and common options
Set the model for a session
Choose a model using an environment variable.
Allow all permissions via environment variable
Enable fully automatic permissions in scripts.
Override the Copilot home directory
Change where config and state files are stored.