Configure the CLI with environment variables
configuration
// what it does
Most settings have an env-var equivalent that overrides the files: GEMINI_MODEL sets the default model, GEMINI_SANDBOX enables sandboxing, GEMINI_API_KEY authenticates, and NO_COLOR disables colored output. The CLI auto-loads .env files, searching the working directory upward to the repo root, then the home directory. Put CLI-specific vars in .gemini/.env.
// shell
$ export GEMINI_MODEL=gemini-2.5-flash$ printf 'GEMINI_MODEL=gemini-2.5-flash\n' > .gemini/.env// gotcha
DEBUG and DEBUG_MODE are deliberately excluded from a project .env so a stray debug flag in a repo does not force verbose logging on everyone — put them in .gemini/.env if you really want them loaded. Env vars beat both project and user settings, so a leftover export can override the file you just edited.