Changing Gemini CLI Directories: Workspace, Project Settings, and Global Config
说明与用途
管理 Gemini CLI 目录:从任何仓库启动,包含其他仓库到工作区,使用 .gemini/ 存储项目设置,并通过环境变量、符号链接或连接点迁移全局配置,保持状态和凭据。
问题
Managing Gemini CLI directory scopes—user, project, and global—while ensuring correct configuration, credentials, and workspace inclusion.
结果
Gemini CLI can be run from any repository, include multiple repositories in its workspace, maintain per‑project settings, and relocate global configuration without losing state or credentials.
工作流
- Start Gemini in desired repo:
cd /path/to/project && gemini - Add another repo to workspace:
gemini --include-directories /path/to/other_repoor/directory add /path/to/other_repo - Create a project .gemini/ directory with settings.json and GEMINI.md and run
geminifrom that folder - Relocate global config: set
GEMINI_CONFIG_DIRenv var or create a symlink/junction to a new location - Verify settings.json and context discovery after relocation
- Diagnose failures by checking include‑directories, project settings, and read permissions
证据
The default user configuration directory is .gemini under your home directory
If your installed version documents the directory override, the shell configuration looks like this: export GEMINI_CONFIG_DIR="$HOME/custom_gemini_dir" gemini
- 记录日期: 2026-09-22T15:45:49.035Z