By default, Gemini Code Assist code customization indexes all the supported code files in your specified repositories.
In many scenarios, you will have specific files or subtrees that you don't want indexed. For example:
- Highly sensitive information with limited access inside your organization
- Old or deprecated code
- Auto-generated or temporary code
You can exclude these files by creating an .aiexclude
file.
How to write an .aiexclude
file
An .aiexclude
file follows the same syntax as a .gitignore
file, with the
following differences:
- An empty
.aiexclude
file blocks all files in its directory and all sub-directories. This result is the same as a file that contains**/*
. - An
.aiexclude
file doesn't support negation, where you prefix patterns with an exclamation point (!
).
Examples
The following examples demonstrate how you can configure an .aiexclude
file:
Block all files named
apikeys.txt
at or below the directory that contains the.aiexclude
file:apikeys.txt
Block all files with the
.key
file extension at or below the directory that contains the.aiexclude
file:*.key
Block only the
apikeys.txt
file at the same directory as the.aiexclude
file, but not any subdirectories:/apikeys.txt
Block all files in the directory
my/sensitive/dir
and all subdirectories. The path should be relative to the directory that contains the.aiexclude
file.my/sensitive/dir/