docs: weekly audit results for 24261164273

This commit is contained in:
g-samroberts
2026-04-10 19:52:40 +00:00
committed by github-actions[bot]
parent 128e3567cb
commit 01ebea3b46
2 changed files with 43 additions and 34 deletions
+26 -27
View File
@@ -1,24 +1,24 @@
# Gemini CLI configuration
Gemini CLI offers several ways to configure its behavior, including environment
variables, command-line arguments, and settings files. This document outlines
the different configuration methods and available settings.
Configure Gemini CLI using environment variables, command-line arguments, and
settings files. This document outlines the different configuration methods and
available settings.
## Configuration layers
Configuration is applied in the following order of precedence (lower numbers are
overridden by higher numbers):
Gemini CLI applies configuration in the following order of precedence (higher
numbers override lower numbers):
1. **Default values:** Hardcoded defaults within the application.
2. **System defaults file:** System-wide default settings that can be
overridden by other settings files.
2. **System defaults file:** System-wide default settings that you can override
with other settings files.
3. **User settings file:** Global settings for the current user.
4. **Project settings file:** Project-specific settings.
5. **System settings file:** System-wide settings that override all other
settings files.
6. **Environment variables:** System-wide or session-specific variables,
potentially loaded from `.env` files.
7. **Command-line arguments:** Values passed when launching the CLI.
7. **Command-line arguments:** Values you pass when launching the CLI.
## Settings files
@@ -27,48 +27,47 @@ locations for these files:
<!-- prettier-ignore -->
> [!TIP]
> JSON-aware editors can use autocomplete and validation by pointing to
> the generated schema at `schemas/settings.schema.json` in this repository.
> JSON-aware editors can provide autocomplete and validation if you point them
> to the generated schema at `schemas/settings.schema.json` in this repository.
> When working outside the repo, reference the hosted schema at
> `https://raw.githubusercontent.com/google-gemini/gemini-cli/main/schemas/settings.schema.json`.
- **System defaults file:**
- **Location:** `/etc/gemini-cli/system-defaults.json` (Linux),
`C:\ProgramData\gemini-cli\system-defaults.json` (Windows) or
`/Library/Application Support/GeminiCli/system-defaults.json` (macOS). The
path can be overridden using the `GEMINI_CLI_SYSTEM_DEFAULTS_PATH`
environment variable.
`/Library/Application Support/GeminiCli/system-defaults.json` (macOS).
Override the path using the `GEMINI_CLI_SYSTEM_DEFAULTS_PATH` environment
variable.
- **Scope:** Provides a base layer of system-wide default settings. These
settings have the lowest precedence and are intended to be overridden by
user, project, or system override settings.
settings have the lowest precedence and you can override them with user,
project, or system override settings.
- **User settings file:**
- **Location:** `~/.gemini/settings.json` (where `~` is your home directory).
- **Scope:** Applies to all Gemini CLI sessions for the current user. User
settings override system defaults.
- **Project settings file:**
- **Location:** `.gemini/settings.json` within your project's root directory.
- **Scope:** Applies only when running Gemini CLI from that specific project.
- **Scope:** Applies only when you run Gemini CLI from that specific project.
Project settings override user settings and system defaults.
- **System settings file:**
- **Location:** `/etc/gemini-cli/settings.json` (Linux),
`C:\ProgramData\gemini-cli\settings.json` (Windows) or
`/Library/Application Support/GeminiCli/settings.json` (macOS). The path can
be overridden using the `GEMINI_CLI_SYSTEM_SETTINGS_PATH` environment
variable.
`/Library/Application Support/GeminiCli/settings.json` (macOS). Override the
path using the `GEMINI_CLI_SYSTEM_SETTINGS_PATH` environment variable.
- **Scope:** Applies to all Gemini CLI sessions on the system, for all users.
System settings act as overrides, taking precedence over all other settings
files. May be useful for system administrators at enterprises to have
controls over users' Gemini CLI setups.
files. This scope is useful for system administrators to manage Gemini CLI
setups across an organization.
**Note on environment variables in settings:** String values within your
`settings.json` and `gemini-extension.json` files can reference environment
`settings.json` and `gemini-extension.json` files reference environment
variables using `$VAR_NAME`, `${VAR_NAME}`, or `${VAR_NAME:-DEFAULT_VALUE}`
syntax. These variables will be automatically resolved when the settings are
loaded. For example, if you have an environment variable `MY_API_TOKEN`, you
could use it in `settings.json` like this: `"apiKey": "$MY_API_TOKEN"`. If you
syntax. Gemini CLI automatically resolves these variables when it loads the
settings. For example, if you have an environment variable `MY_API_TOKEN`, you
can use it in `settings.json` like this: `"apiKey": "$MY_API_TOKEN"`. If you
want to provide a fallback value, use `${MY_API_TOKEN:-default-token}`.
Additionally, each extension can have its own `.env` file in its directory,
which will be loaded automatically.
Additionally, each extension has its own `.env` file in its directory, which
loads automatically.
**Note for Enterprise Users:** For guidance on deploying and managing Gemini CLI
in a corporate environment, see the