.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:

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:

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.