Cursor does not ignore files in .gitignore

Hey @nickredmark, per the docs the current behavior is expected. .gitignore and the default ignore list which includes .env* only apply to indexing. To block access for Agent, Tab, and Inline Edit, you need .cursorignore. It’s a separate, stricter mechanism.

From the docs: Ignore File | Cursor Docs

.cursorignore blocks access from: Semantic search, Tab, Agent, Inline Edit, and @ mentions.
Default ignore list and .gitignore apply to indexing only.

So .cursorignore isn’t a workaround, it’s the intended tool for this. If you don’t want to add it to every project, there’s a global option: VS Code Settings > General > Global Cursor Ignore List, add **/.env and **/.env.*.

I agree the line “Cursor already ignores .env files” in the docs can be confusing because it doesn’t clarify the scope.

@fenmati, about where this setting lives in VS Code Settings, I get that it’s not obvious. I passed the feedback to the team.