Ignore Files
The .cursorignore
file lets you exclude files and directories from Cursor’s codebase indexing
About .cursorignore
To ignore files from being included in codebase indexing, you
can use a .cursorignore
file in the root of your project. It works the same way as .gitignore
works for git.
.cursorignore
respects .gitignore
. If you already have .gitignore
, the files will be ignored by default.
If you want to ignore additional files, you can add them to the .cursorignore
file.
You can read more about how this works on our security page.
Chat and Composer Context
Currently, Cursor Chat and Composer have access to all files in their context, regardless of .cursorignore
settings.
More info on how we handle AI request can be found on our security page.
Example .cursorignore
files
Ignore specific files
Only include specific files
Include only *.py
files in the app
directory. Note that this is the same syntax as .gitignore
.
Troubleshooting
The ignore file syntax is sometimes a bit confusing. The .cursorignore
file follows the exact same syntax as .gitignore
, so if you are trying an ignore file and it doesn’t work the way you expect it to, we recommend a Google search for the issue, replacing cursorignore
in your search query with gitignore
. Probably someone will have had the same issue and StackOverflow will have a good answer.
One common example: here is how you ignore all files except those with a .php
extension (just adding *
followed by !*.php
does not work because the gitignore file discoverer will not descend into and discover any .php
files in subdirectories).