.geminiignore in Gemini CLI — Ignore Files and Directories
Official Link: https://geminicli.com/docs/cli/gemini-ignore/
When working with Gemini CLI, you may have files that should not be shared with Gemini tools.
Examples include:
- API keys
- sensitive configuration files
- large folders like node_modules
- archived datasets
To control this behavior, Gemini CLI provides the .geminiignore file, which works similarly to .gitignore.
What is .geminiignore?
.geminiignore is a configuration file used by Gemini CLI to exclude specific files or directories from Gemini operations.
Important characteristics:
- Prevents files from being used by Gemini CLI tools
- Works similar to .gitignore
- Does NOT affect Git
- Uses pattern matching (glob patterns)
Key idea:
Gemini CLI reads .geminiignore and skips those files automatically when tools interact with the project.
Example scenario:
Project Folder
Project Folder │ ├── app.py ├── config.yaml ├── apikeys.txt ├── archive/ └── .geminiignore
If .geminiignore contains:
.geminiignore
apikeys.txt /archive/
Gemini CLI will ignore those files.