# Is it possible to index a file that's in my .gitignore?

**URL:** <https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771>\
**Category:** Feature Requests\
**Created:** [February 7, 2024, 4:09pm UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771 "2024-02-07T16:09:00Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![eugenekim](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@eugenekim](https://forum.cursor.com/u/eugenekim)\
**Post date:** [February 7, 2024, 4:09pm UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/1 "2024-02-07T16:09:00Z")

</div>

I have a Typescript project. All node\_modules are in my .gitignore

Some of the node\_module dependencies have types I’d like to be able to have indexed and made available when interacting with the LLM.

Is it possible to add explicit overrides? Currently I have a workspace where the two root directories are my project and the dependency, but it’s a far from ideal workflow since some VSCode configs that I have in my project assume a base directory that is my project and not a parent directory.

---

<div class="post-metadata">

**Author:** ![arvid220u](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/arvid220u/32/82089_2.png) [@arvid220u](https://forum.cursor.com/u/arvid220u)\
**Post date:** [February 8, 2024, 1:29am UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/2 "2024-02-08T01:29:56Z")

</div>

You can add `!path/to/folder` to your `.cursorignore` to make sure the folder gets included even if it’s ignored by gitignore. Note that you may need to add `!path/to/folder/*` or `!path/to/folder/**/*` (see [this SO answer for more details](https://stackoverflow.com/questions/5533050/gitignore-exclude-folder-but-include-specific-subfolder)).

---

<div class="post-metadata">

**Author:** ![eugenekim](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@eugenekim](https://forum.cursor.com/u/eugenekim)\
**Post date:** [February 8, 2024, 8:07pm UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/3 "2024-02-08T20:07:18Z")

</div>

Thanks for the reply @arvid220u

I’m unable to verify whether this is working. I’ve opened a related topic since I’m unable to get Symbols to work for code in my node\_modules

> [@@ Symbols do not work for code in node\_modules when .gitignore and .cursorignore do not exist](https://forum.cursor.com/t/symbols-do-not-work-for-code-in-node-modules-when-gitignore-and-cursorignore-do-not-exist/2799):
>
> I’m unable to get @ Symbols working in cursor for code in my node\_modules. I do not have a .gitignore nor a .cursorignore I’ve deleted and recreated indexes with no luck. What am I missing? Here’s a demo repo you can use for your convenience that has a screen recording:

---

<div class="post-metadata">

**Author:** ![eugenekim](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@eugenekim](https://forum.cursor.com/u/eugenekim)\
**Post date:** [February 11, 2024, 7:08pm UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/4 "2024-02-11T19:08:39Z")

</div>

@arvid220u I tried doing this a different way and while I got Cursor to index the files in a dir that’s in my .gitignore, I’m unable to get the symbols to show up.

I created a `./tmp` dir in my project that’s ignored by git and copied a dependency that’s in my `./node_modules` into `./tmp`. After I configured my `.cursorignore` to add negations for the `./tmp` dir, resyncing the index resulted in the files in `./tmp` being picked up.

I’m still unable to get _anything_ that’s in tmp as an @ Symbol.

However, **when I comment out the tmp dir in .gitignore, I’m able to use the @ Symbols! It looks as if Cursor has a blocklist for all files covered in .gitignore when it comes to @ Symbols, even if .cursorignore negates them and allows them to be indexed**. Can you confirm this is the case? If so, can we update Cursor to respect the negated files in .cursorignore?

---

<div class="post-metadata">

**Author:** ![arvid220u](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/arvid220u/32/82089_2.png) [@arvid220u](https://forum.cursor.com/u/arvid220u)\
**Post date:** [February 11, 2024, 7:37pm UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/5 "2024-02-11T19:37:17Z")

</div>

This is indeed the case! @ symbols currently do not follow the cursorignore file.

They probably should! Requires some careful work on our end, though, so may take some time.

---

<div class="post-metadata">

**Author:** ![eugenekim](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@eugenekim](https://forum.cursor.com/u/eugenekim)\
**Post date:** [February 11, 2024, 9:00pm UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/6 "2024-02-11T21:00:14Z")

</div>

Got it, thanks for the response!

---

<div class="post-metadata">

**Author:** ![coreyward](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/coreyward/32/2202_2.png) [@coreyward](https://forum.cursor.com/u/coreyward)\
**Post date:** [July 15, 2024, 10:24pm UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/7 "2024-07-15T22:24:29Z")

</div>

I’d love to see this improved. If it’s helpful to know, I’m generating a schema dump of the database to include as context in Chat. This let’s me get more relevant answers, but I’m having a hard time keeping it out of SCM. If I .gitignore the file or add it to `.git/info/exclude` it’s not available in Cursor Chat at all.

---

<div class="post-metadata">

**Author:** ![leo0xm](https://avatars.discourse-cdn.com/v4/letter/l/43a26b/32.png) [@leo0xm](https://forum.cursor.com/u/leo0xm)\
**Post date:** [August 15, 2024, 7:59am UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/8 "2024-08-15T07:59:50Z")

</div>

Is this feature add in yet? I want to get some files be index by cursor to use in LLM but don’t want add to git and got no way to make it works. Hope it soon

---

<div class="post-metadata">

**Author:** ![andrejj](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/andrejj/32/13223_2.png) [@andrejj](https://forum.cursor.com/u/andrejj)\
**Post date:** [December 9, 2024, 10:26am UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/9 "2024-12-09T10:26:05Z")

</div>

Hi I’m facing the same problem too.  
Use case: I want cursor to index a UI library and use it to to build the UI.  
Because it’s source is in a git ignored folder it can’t do much with it, library is relatively new and updated daily.  
I only got it to work by not .gitignoring the library’s folder.

---

<div class="post-metadata">

**Author:** ![Melody20168066](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/melody20168066/32/19205_2.png) [@Melody20168066](https://forum.cursor.com/u/Melody20168066)\
**Post date:** [February 8, 2025, 3:29am UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/10 "2025-02-08T03:29:58Z")

</div>

Is there any expected support time? It’s a little urgent for me.

---

<div class="post-metadata">

**Author:** ![danperks](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/danperks/32/19087_2.png) [@danperks](https://forum.cursor.com/u/danperks)\
**Post date:** [February 17, 2025, 8:45am UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/11 "2025-02-17T08:45:39Z")

</div>

We’re actively working on improving how Cursor handles files in .gitignore, but there’s no specific timeline for this feature yet. For now, the workaround is to not .gitignore the files you need indexed - though I know that’s not ideal for your situation

---

<div class="post-metadata">

**Author:** ![Lukafin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/lukafin/32/34883_2.png) [@Lukafin](https://forum.cursor.com/u/Lukafin)\
**Post date:** [March 10, 2025, 1:23pm UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/12 "2025-03-10T13:23:24Z")

</div>

I am working on a kotlin multiplatform project that generates a lot of files from openapi spec. I still need to reference them when working on ios and android clients, but i cant since we have them in .gitignore.  
Please improve this. Thanks.

---

<div class="post-metadata">

**Author:** ![BMCwebdev](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/bmcwebdev/32/36981_2.png) [@BMCwebdev](https://forum.cursor.com/u/BMCwebdev)\
**Post date:** [May 14, 2025, 11:42am UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/13 "2025-05-14T11:42:52Z")

</div>

Wanted to check in, is this still an issue?

My use case: I manage a design system installed and used by teams at my company. It would be extremely helpful if Cursor could index and `@` the files in the node modules directory.

---

<div class="post-metadata">

**Author:** ![BMCwebdev](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/bmcwebdev/32/36981_2.png) [@BMCwebdev](https://forum.cursor.com/u/BMCwebdev)\
**Post date:** [May 16, 2025, 8:37pm UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/14 "2025-05-16T20:37:03Z")

</div>

Does not seem to have been updated in 0.50

Still cannot instruct Cursor to index a directory inside of node\_modules.

I’m sure this is a huge use case.

---

<div class="post-metadata">

**Author:** ![BMCwebdev](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/bmcwebdev/32/36981_2.png) [@BMCwebdev](https://forum.cursor.com/u/BMCwebdev)\
**Post date:** [May 19, 2025, 3:20am UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/15 "2025-05-19T03:20:32Z")

</div>

Can anyone speak to the current status of this? Would be immensely helpful to have a bit of insight for planning. Thanks!

---

<div class="post-metadata">

**Author:** ![BMCwebdev](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/bmcwebdev/32/36981_2.png) [@BMCwebdev](https://forum.cursor.com/u/BMCwebdev)\
**Post date:** [June 3, 2025, 8:02pm UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/16 "2025-06-03T20:02:10Z")

</div>

Just checking in. Pinging this thread to update it.

---

<div class="post-metadata">

**Author:** ![CrunchyBuddy](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/crunchybuddy/32/95584_2.png) [@CrunchyBuddy](https://forum.cursor.com/u/CrunchyBuddy)\
**Post date:** [June 9, 2025, 5:42pm UTC](https://forum.cursor.com/t/is-it-possible-to-index-a-file-thats-in-my-gitignore/2771/17 "2025-06-09T17:42:43Z")

</div>

I’m really struggling with this too. Cursor tried to help me by telling me to just add negative entries to the .cursorignore but that didn’t work… and it later told me that it probably wouldn’t. I don’t understand the decisions here; I generate code because I need it to exist and it is key to the project’s execution but I don’t want to commit it. With the existence of a .cursorignore why even parse the .gitignore? If I’ve read the docs enough to create a .cursorignore surely I’m smart enough to copy what I want out of my .gitignore; I’m a programmer and maybe I even have a build step that `grep -vE "gen|vendor" > .cursorignore` and I’m golden.

Anyway- I want some way to pass _some_ generated and vendored code as context but even removing these entries from my `.gitignore` in the hopes that Cursor would pick it up, it does only partially. I can `@` the directories sometimes in the chat window but they don’t ever show up in the add context flyout.

**Edit:** After discovering the “Indexing & Docs” tab in Cursor Settings, having that open in a tab, letting “View included files” open in another tab, and then tabs for `.gitignore` and `.cursorignore` I think I’ve worked out how to make it go; maybe the arcane behavior is due to the way the `.gitignore` is specified to work but now my `.cursorignore` is longer than my `.gitignore` simply to include a few things that I want, which would be obviated by assuming that `.gitignore` meant “files that are important to the project but that don’t need to be in source control” instead of Cursor’s assumption of “files that are unimportant, why are they here if they have no meaning, are the devs dumb?”

For anyone else who stumbles by but doesn’t see the other threads, you’ve got to unignore the thing in your .gitignore and then unignore every parent directory on its own line up to the point where you can `**/*` it.

In my case, in a Go project where I don’t actually commit vendor dependencies but pull them down for reference, my `.gitignore` looks like

```auto
/vendor

```

and my `.cursorignore` looks like

```auto
!/vendor
/vendor/*
!/vendor/gitlab.com
/vendor/gitlab.com/*
!/vendor/gitlab.com/mycompany
/vendor/gitlab.com/mycompany/*
!/vendor/gitlab.com/mycompany/api_project
!/vendor/gitlab.com/mycompany/api_project/**/*

```
