You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
5.**System settings file:** System-wide settings that override all other settings files.
14
+
6.**Environment variables:** System-wide or session-specific variables, potentially loaded from `.env` files.
15
+
7.**Command-line arguments:** Values passed when launching the CLI.
15
16
16
17
## Settings files
17
18
18
-
Gemini CLI uses `settings.json` files for persistent configuration. There are three locations for these files:
19
+
Gemini CLI uses JSON settings files for persistent configuration. There are four locations for these files:
19
20
21
+
-**System defaults file:**
22
+
-**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.
23
+
-**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.
20
24
-**User settings file:**
21
25
-**Location:**`~/.gemini/settings.json` (where `~` is your home directory).
22
-
-**Scope:** Applies to all Gemini CLI sessions for the current user.
26
+
-**Scope:** Applies to all Gemini CLI sessions for the current user. User settings override system defaults.
23
27
-**Project settings file:**
24
28
-**Location:**`.gemini/settings.json` within your project's root directory.
25
-
-**Scope:** Applies only when running Gemini CLI from that specific project. Project settings override user settings.
29
+
-**Scope:** Applies only when running Gemini CLI from that specific project. Project settings override user settings and system defaults.
26
30
-**System settings file:**
27
31
-**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.
28
-
-**Scope:** Applies to all Gemini CLI sessions on the system, for all users. System settings override user and project settings. May be useful for system administrators at enterprises to have controls over users' Gemini CLI setups.
32
+
-**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.
29
33
30
34
**Note on environment variables in settings:** String values within your `settings.json` files can reference environment variables using either `$VAR_NAME` or `${VAR_NAME}` 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"`.
Copy file name to clipboardExpand all lines: docs/cli/enterprise.md
+33-14Lines changed: 33 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,23 +6,27 @@ This document outlines configuration patterns and best practices for deploying a
6
6
7
7
## Centralized Configuration: The System Settings File
8
8
9
-
The most powerful tool for enterprise administration is the system-wide `settings.json` file. This file allows you to define a baseline configuration that applies to all users on a machine. For a complete overview of configuration options, see the [Configuration documentation](./configuration.md). Settings from system, user, and project-level `settings.json` files are merged together. For most settings, the system-wide configuration takes precedence, overriding any conflicting user or project-level settings. However, some settings, like `customThemes`, `mcpServers`, and `includeDirectories`, are merged from all configuration files, and if there are conflicting values (e.g., both workspace and system settings have a 'github' MCP server defined), the system value will take precedence.
9
+
The most powerful tools for enterprise administration are the system-wide settings files. These files allow you to define a baseline configuration (`system-defaults.json`) and a set of overrides (`settings.json`) that apply to all users on a machine. For a complete overview of configuration options, see the [Configuration documentation](./configuration.md).
10
+
11
+
Settings are merged from four files. The precedence order for single-value settings (like `theme`) is:
This means the System Overrides file has the final say. For settings that are arrays (`includeDirectories`) or objects (`mcpServers`), the values are merged.
10
19
11
20
**Example of Merging and Precedence:**
12
21
13
22
Here is how settings from different levels are combined.
This results in the following merged configuration:
60
78
61
79
-**Final Merged Configuration:**
@@ -74,18 +92,19 @@ This results in the following merged configuration:
74
92
}
75
93
},
76
94
"includeDirectories": [
77
-
"/etc/gemini-cli/global-context",
95
+
"/etc/gemini-cli/common-context",
78
96
"~/gemini-context",
79
-
"./project-context"
97
+
"./project-context",
98
+
"/etc/gemini-cli/global-context"
80
99
]
81
100
}
82
101
```
83
102
84
103
**Why:**
85
104
86
-
-**`theme`**: The value from the system settings is used, overriding both user and workspace settings.
87
-
-**`mcpServers`**: The objects are merged. The `corp-server` definition from the system settings takes precedence over the user's definition. The unique `user-tool` and `project-tool` are included.
88
-
-**`includeDirectories`**: The arrays are concatenated in the order of System, User, and then Workspace.
105
+
-**`theme`**: The value from the system overrides (`system-enforced-theme`) is used, as it has the highest precedence.
106
+
-**`mcpServers`**: The objects are merged. The `corp-server` definition from the system overrides takes precedence over the user's definition. The unique `user-tool` and `project-tool` are included.
107
+
-**`includeDirectories`**: The arrays are concatenated in the order of System Defaults, User, Workspace, and then System Overrides.
0 commit comments