# Questions on .gitignore, .cursorignore, .cursorban

**URL:** <https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713>\
**Category:** Feedback\
**Created:** [December 13, 2024, 5:41pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713 "2024-12-13T17:41:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![wbtacc](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/wbtacc/32/15815_2.png) [@wbtacc](https://forum.cursor.com/u/wbtacc)\
**Post date:** [December 13, 2024, 5:41pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/1 "2024-12-13T17:41:51Z")

</div>

I read [Cursor – Ignore Files](https://docs.cursor.com/context/ignore-files#ignore-files) and [Security | Cursor - The AI Code Editor](https://www.cursor.com/security#codebase-indexing). I performed tests. I have concerns.

1. **Can `.gitignore`-ed files “still be included in AI requests, such as if you recently viewed a file and then ask a question in the chat”?** (I can add a `.gitignore`-d file I view, or have recently viewed, to context.)

2. **Is new “Agent” Composer feature designed to respect `.gitignore`?** I believe it does **not** respect it. (If chosen, “Agent” Composer can implicitly access an entire project as context. When asked whether it can access a `.gitinore`-d directory, it answered yes, and listed the files in that directory. When asked whether it could read the contents of those files, it answered yes and showed the contents of one file and one child directory file. See attached screenshots.)

3. **What security gotchas does “Agent” Composer introduce?** I do not see the new “Agent” Composer feature mentioned on either page I read.

4. **What files are considered by Cursor as “recently viewed files” and for how long?**

5. **Can a warning occur before use of a “recently used file” if it is `.gitignore`-d or `.cursorignor`-d.**

My goal is to avoid sensitive data being accidentally transmitted to Cursor (e.g. if Privacy mode is off).

I feel the `.cursorban` the Cursor team is considering would be a band-aid. Instead, I propose access to `.gitignore`-d or `.cursorignore`-d files be strictly respected. Implementing UI to explicitly override inaccessibility of those files could be acceptable. Allowing “recently viewed” files seems vague and implicit.

---

<div class="post-metadata">

**Author:** ![markuseicher](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/markuseicher/32/15573_2.png) [@markuseicher](https://forum.cursor.com/u/markuseicher)\
**Post date:** [December 13, 2024, 10:07pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/2 "2024-12-13T22:07:28Z")

</div>

Thanks for bringing this up. Very concerning and the show-stopper for us to use Cursor. Very bad, because the tool would be great, if it was secure.

---

<div class="post-metadata">

**Author:** ![msfeldstein](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/msfeldstein/32/12884_2.png) [@msfeldstein](https://forum.cursor.com/u/msfeldstein)\
**Post date:** [December 14, 2024, 1:02am UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/3 "2024-12-14T01:02:49Z")

</div>

I definitely hear this… the counter-argument is that it does harm performance by restricting access to auto-generated code files (like TS headers generated from protobuf) which are really useful for getting things right. It takes a lot of the magic out of it. Additionally the case of the agent, setting up and modifying an .env file is a pretty standard agent workflow.

However, risking the leak of an env file is an extremely big deal.

How would you feel about us auto-banning `.env*` and a set of other sensitive files (.pem, etc) while we figure out a better solution?

I’m thinking a ternary setting

- Block all .gitignore
- Block sensitive files (default)
- Allow everything

---

<div class="post-metadata">

**Author:** ![wbtacc](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/wbtacc/32/15815_2.png) [@wbtacc](https://forum.cursor.com/u/wbtacc)\
**Post date:** [December 16, 2024, 4:19pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/4 "2024-12-16T16:19:00Z")

</div>

I love the magic. Composer “agent” mode is exciting. I just really don’t want new devs accidentally sending credentials to various third-party servers 😅 whether those servers store those cred’s or not (“Privacy mode”).

> [@msfeldstein](#):
>
> - Block all .gitignore
> - Block sensitive files (default)
> - Allow everything

Such a setting sounds good!

1. **Where could this new setting live?** Maybe a new section “Privacy & Security” (to which “Privacy mode” might move). Just having such a section might further highlight Cursor’s dedication to this aspect of the software.\[1\]
2. **Where would “sensitive files” be defined?** I guess a webpage, because I assume _neither_ help text _nor_ tooltip would be adequate to list all entries.
3. **Is “recently viewed” defined anywhere?** [Is it whatever VS Code’s logic is for _recently opened_?]

* * *

1. “Privacy mode”, and the choice of it in onboarding, is what made me feel good about trying Cursor.

---

<div class="post-metadata">

**Author:** ![aaa](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@aaa](https://forum.cursor.com/u/aaa)\
**Post date:** [December 18, 2024, 2:30am UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/5 "2024-12-18T02:30:37Z")

</div>

We sometimes have files under a .secrets folder in our repositories.

We similarly would like to prevent any of those files from being looked at by Cursor AI.

We also have folders where we have the data of our users.

In addition to automatically not touching some common default set of files, we would like to also be able to ban particular folders that contain sensitive data.

---

<div class="post-metadata">

**Author:** ![wbtacc](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/wbtacc/32/15815_2.png) [@wbtacc](https://forum.cursor.com/u/wbtacc)\
**Post date:** [December 19, 2024, 10:33pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/6 "2024-12-19T22:33:33Z")

</div>

🤔 **`.cursorignore` Use Case & Caveat**  
One can commit `.cursorignore` to a repository, to manage that repository, which allows repository-level control like `.gitignore` could. Drawback: this is an IDE-specific config. It is preferable to commit config files that all IDE’s can respect i.e. a standard; but AI-IDE–integration is probably not there yet.

**Update** : Google/Android has `.aiexclude`, and there is [a small effort for GitHub to adopt that](https://github.com/orgs/community/discussions/11254#discussioncomment-10461122).

**Update** : (new topic) [Proposal: `.aiexclude` an IDE-agnostic `.cursorignore`](https://forum.cursor.com/t/proposal-aiexclude-an-ide-agnostic-cursorignore/36161).

---

<div class="post-metadata">

**Author:** ![wbtacc](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/wbtacc/32/15815_2.png) [@wbtacc](https://forum.cursor.com/u/wbtacc)\
**Post date:** [December 19, 2024, 10:33pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/7 "2024-12-19T22:33:43Z")

</div>

1. **Will Cursor (a VS Code fork) respect [GitHub Copilot Content exclusion](https://docs.github.com/en/copilot/managing-copilot/configuring-and-auditing-content-exclusion/excluding-content-from-github-copilot)?**

---

<div class="post-metadata">

**Author:** ![ericzakariasson](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/ericzakariasson/32/11130_2.png) [@ericzakariasson](https://forum.cursor.com/u/ericzakariasson)\
**Post date:** [December 21, 2024, 3:47pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/8 "2024-12-21T15:47:15Z")

</div>

hey! just wanted to share that we’re working on this. not ready yet, but getting there. will let you know!

---

<div class="post-metadata">

**Author:** ![ericzakariasson](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/ericzakariasson/32/11130_2.png) [@ericzakariasson](https://forum.cursor.com/u/ericzakariasson)\
**Post date:** [January 8, 2025, 3:33pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/9 "2025-01-08T15:33:56Z")

</div>

don’t have that much progress to share yet unfortunately, but we’ll make sure to share once there is!

---

<div class="post-metadata">

**Author:** ![slh](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/slh/32/18137_2.png) [@slh](https://forum.cursor.com/u/slh)\
**Post date:** [January 31, 2025, 3:57am UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/10 "2025-01-31T03:57:11Z")

</div>

My preference, for what it’s worth:

Neither Composer, nor Chat, Tab, nor any other Cursor service can read files in .cursorignore. It will not let you add these files to the chat context manually either. If a user wants cursor to read the file, they can remove it from .cursorignore.

In this way it would follow the same security principles that .gitignore exists to serve. i.e. the files are effectively invisible to the program and at no risk of being sent over a network, seen or stored by any other server.

---

<div class="post-metadata">

**Author:** ![wbtacc](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/wbtacc/32/15815_2.png) [@wbtacc](https://forum.cursor.com/u/wbtacc)\
**Post date:** [January 31, 2025, 5:11pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/11 "2025-01-31T17:11:51Z")

</div>

That’s certainly how I had expected it to work.

I worry the problem may have now become user experience for those who wouldn’t expect that — if only because it hadn’t worked like that before, so Cursors seeks a backwards-compatible solution. 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![FinDevAI](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/findevai/32/89390_2.png) [@FinDevAI](https://forum.cursor.com/u/FinDevAI)\
**Post date:** [January 31, 2025, 5:31pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/12 "2025-01-31T17:31:28Z")

</div>

.gitignore and .cursorignore need to be two different animals. It’s the users responsibility to understand that. Don’t dumb down the system for beginners and penalize experienced programmer’s in the process.

Cursor isn’t a baby sitting service, it’s a productivity tool for professionals.

---

<div class="post-metadata">

**Author:** ![DeathRJJ](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deathrjj/32/25233_2.png) [@DeathRJJ](https://forum.cursor.com/u/DeathRJJ)\
**Post date:** [February 8, 2025, 10:10am UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/13 "2025-02-08T10:10:39Z")

</div>

The newest changelog mentions “team-configurable blocklists”  
But there doesn’t seem to be any info about what that actually means.  
I emailed cursor and they said they’ll ask product and come back to me, and i posted a thread about it [here](https://forum.cursor.com/t/team-configurable-blocklists/48467)

@ericzakariasson Do you have any info on this?

---

<div class="post-metadata">

**Author:** ![DeathRJJ](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deathrjj/32/25233_2.png) [@DeathRJJ](https://forum.cursor.com/u/DeathRJJ)\
**Post date:** [February 8, 2025, 10:16am UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/14 "2025-02-08T10:16:20Z")

</div>

I agree, however the proposed .`cursorban` feature would do this and it might be nice to have the option to have both so that you can disable it entirely for some files/dirs/repos but you can just disable the automatic indexing with `.cursorignore`

It is mentioned here: [Security | Cursor - The AI Code Editor](https://www.cursor.com/security#codebase-indexing)

I’ve done it but the more the better so it’s worth sending an email to them saying you would appreciate the feature.

---

<div class="post-metadata">

**Author:** ![ericzakariasson](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/ericzakariasson/32/11130_2.png) [@ericzakariasson](https://forum.cursor.com/u/ericzakariasson)\
**Post date:** [February 11, 2025, 11:22am UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/15 "2025-02-11T11:22:02Z")

</div>

`.cursorban` capabilities (probably just under .cursorignore) will go out in 0.46 if nothing unexpected comes up!

---

<div class="post-metadata">

**Author:** ![codekiln](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/codekiln/32/22614_2.png) [@codekiln](https://forum.cursor.com/u/codekiln)\
**Post date:** [March 3, 2025, 10:56am UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/16 "2025-03-03T10:56:22Z")

</div>

@ericzakariasson 0.46 is out and changelog is here - [Changelog - Feb 19, 2025 | Cursor - The AI Code Editor | Cursor - The AI Code Editor](https://www.cursor.com/changelog/agent-is-ready-and-ui-refresh)  
Here’s what I see:

> - **Ignore files** : `.cursorignore` now blocks files from being added in chat or sent up for tab completions, in addition to ignoring them from indexing. We’ve introduced `.cursorindexingignore` for specifically controlling file indexing.

Given the language at [Security | Cursor - The AI Code Editor](https://www.cursor.com/security), I’m not sure I understand the new intended state of how to manage secrets:

> Files and subdirectories specified by `‘.gitignore’` or `‘.cursorignore’` are ignored. …
> 
> - While a `‘.cursorignore’` file can prevent files from being indexed, those files may still be included in AI requests, such as if you recently viewed a file and then ask a question in the chat. We are considering adding a `‘.cursorban’` file to address the use case of wanting to block files from being sent up in any request — please make a forum post or reach out at [hi@cursor.com](mailto:hi@cursor.com) if this is a feature that would be interesting to you.

In my opinion, Cursor strongly needs 1.) a Docs page in the header for quick access, and 2.) a dedicated “Secrets Management” docs page that specifically mention the use cases for when one needs to use `.gitignore` vs `.cursorignore` vs `.cursorindexingignore` vs `.cursorban`, and how best to keep secrets out of cursor.

While it’s nice that docs search is endowed with RAG over the docs, it needs to be endowed the ability to cite references or, preferably, to switch to a classical search mode so we can get citable links to “see the proof.” I asked this question, and all I got was an answer (which looks to be accurate as of 0.46 - great!), but without any citable links to the documentation, which is what I really wanted, so I can link in my team’s documentation on how to use Cursor safely:

 ![image](https://us1.discourse-cdn.com/cursor1/original/3X/9/1/91564568dfcd3166be2e3efb4d33f3a621d7004e.png)

@ericzakariasson will you please impress upon the cursor documentation team how critical it is to enterprises and business teams to dispel any possible ambiguity about how secrets can be kept out of cursor.

UPDATE - I see that there’s a [Cursor – Ignore Files](https://docs.cursor.com/context/ignore-files) docs page. I think I understand now, so `.cursorindexingignore` automatically inherits `.gitignore`, but `.cursorignore` doesn’t? That could be clearer. Under [Cursor – Ignore Files](https://docs.cursor.com/context/ignore-files#files-ignored-by-default) I see that the files ignored by default include `.env`, but I definitely saw one instance of the agent looking inside my .env file this weekend on 0.46, even though .env was explicitly specified in `.gitignore`… which was a PITA since I then had to rotate my secrets (thank goodness I was using API keys scoped to the project). So I take it that the “files ignored by default” actually just should be called “files ignored from indexing by default”?

---

<div class="post-metadata">

**Author:** ![wbtacc](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/wbtacc/32/15815_2.png) [@wbtacc](https://forum.cursor.com/u/wbtacc)\
**Post date:** [March 3, 2025, 6:15pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/17 "2025-03-03T18:15:33Z")

</div>

I’ve tested version `0.46.x`. (Great improvements!)

At least together, the `.cursorignore` and `.cursorindexingignore` work as I expect.

- ✅ [with cursor…ignore - does **not** use content of ignored file](https://forum.cursor.com/uploads/short-url/n0Fp5eCmLb7lfPTqcMRoeMiEJOL.png)
- ✅ [with cursor…ignore - does **not** index ignored file](https://forum.cursor.com/uploads/short-url/l7rHkGnZuoL6vbTY9qDSicxjX3u.png)
- ✅ with cursor…ignore - can **not** add context via `@`
- ✅ with cursor…ignore - can **not** add context via drag and drop
- ✅ with cursor…ignore - can **not** find the file when given the path

* * *

I don’t see `.cursor(…)ignore` inherit from `.gitignore` —

- ❓ [with only gitignore - **can** index ignored file](https://forum.cursor.com/uploads/short-url/zS8TeuRXc0T83kA1gAUx2ERNHJ3.png)
- ❓ [with only gitignore - **can** add context via `@`](https://forum.cursor.com/uploads/short-url/1H9Eb1tetjSQAHnAx7tuJIjZj2p.png)
- ❓ with only gitignore - **can** add context via drag-n-drop
- ❓ with only gitignore - **can** read file content

— or I don’t understand how it works.

---

<div class="post-metadata">

**Author:** ![wbtacc](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/wbtacc/32/15815_2.png) [@wbtacc](https://forum.cursor.com/u/wbtacc)\
**Post date:** [March 3, 2025, 6:22pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/18 "2025-03-03T18:22:22Z")

</div>

My concerns have a solution\[1\]. My original questions have answers.

Thank you @msfeldstein, @ericzakariasson, and Cursor.

* * *

> 1. Can `.gitignore`-ed files “still be included in AI requests, such as if you recently viewed a file and then ask a question in the chat”?

1. ✅ ⚠ **Yes, unless** you use `.cursor(…)ignore`.

> 1. Is new “Agent” Composer feature designed to respect `.gitignore`?

1. ✅ ⚠ **Yes, but** read the docs and test.

> 1. What security gotchas does “Agent” Composer introduce?

1. 🙂 Those we’ve reported, which can be mitigated via `.cursor…ignore` files.

> 1. What files are considered by Cursor as “recently viewed files” and for how long?

1. ❌ **Unclear.** Use `.cursor(…)ignore` to control Cursor access.

> 1. Can a warning occur before use of a “recently used file” if it is `.gitignore`-d or `.cursorignor`-d.

1. ✅ **It could, but** to resolve the security concern behind this question, `.cursor(…)ignore` should be used to prevent access to such files.

* * *

1. version `0.46.x`

---

<div class="post-metadata">

**Author:** ![Lalala](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/lalala/32/27654_2.png) [@Lalala](https://forum.cursor.com/u/Lalala)\
**Post date:** [March 9, 2025, 1:18pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/19 "2025-03-09T13:18:41Z")

</div>

What happens to content in editor tabs that weren’t saved to a file yet ? Dev often open an editor to temporarily paste a password or other secret information. Is there a way for me to have Cursor ignore these as well ?

---

<div class="post-metadata">

**Author:** ![wbtacc](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/wbtacc/32/15815_2.png) [@wbtacc](https://forum.cursor.com/u/wbtacc)\
**Post date:** [March 11, 2025, 3:43pm UTC](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713/20 "2025-03-11T15:43:04Z")

</div>

Good question. Easy to test. Ask the chat whether it can access, or ask it to do something with the content.

I tested with Editor and Agent, both said they did **not** have access to the content (not shown) of my unsaved (see black dot next o filename) scratch file.

| Edit | Agent |
| --- | --- |
| ![Can Edit Chat See](https://us1.discourse-cdn.com/cursor1/original/3X/8/5/85c41bcd6093f122df51367dac73401494c46c40.png) | ![Can Agent Chat See](https://us1.discourse-cdn.com/cursor1/original/3X/0/d/0d67bee2bff75c6b94132c92639a22a0611d6506.png) |

[Next page](https://forum.cursor.com/t/questions-on-gitignore-cursorignore-cursorban/34713.md?page=2)
