Unofficial project — not affiliated with, endorsed by, or operated by Cursor (Anysphere). This is a personal prototype using publicly available help content.

Ignore files

Control which files Cursor indexes and includes in AI context by using ignore files.

How do I exclude files from Cursor?

Create a .cursorignore file in your project root. Add patterns for files and folders you want excluded:

Cursor already ignores .env files, .git/, and lock files by default. See the full default ignore list for details.

Ignored files are blocked from indexing and Agent. Terminal commands and MCP tools run outside of Cursor's file access controls, so they may still be able to read ignored files.

Does Cursor respect .gitignore?

Yes. Cursor automatically respects your .gitignore patterns. Files ignored by git are also ignored by Cursor's indexing.

.cursorignore is for additional exclusions beyond what .gitignore covers.

Why should I ignore files?

  • Large generated files slow down indexing
  • Secrets and credentials are safer excluded from AI context
  • Binary files and assets add noise without value
  • Third-party code (like node_modules) is rarely useful as context

Related

  • Ignore files reference
Was this page helpful?