You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Search @ cannot search from directories excluded by .gitignore #2952
In VS Code IDE plugin, when typing @ to search a file, only files tracked by git can be searched.
The problem is, in many situations I need to wrote scripts, temp function or handling some sample data. Those related files are not supposed to be tracked by git. I usually put them in a git ignored directory, such as playground/, .local/, temp/ .
If it's about security & privacy issue, would it be designed to read git ignored files only when it's commanded?
What is the expected behavior?
Allow @ files even it's not tracked by git.
What do you see instead?
@ action cannot search git ignored files
Additional information
No response
Reacted by Beehive Innovations, Noname Oni, MantraMedia, lichu acuña, Alexander, Carlos, Maximilian Krupop, Josh Woomin Park, geraldpeng6, sagewe and 139 more
Reacted by Chen Gong, hanpei, Pawel Mackiewicz, Dimas Dani Zaini, Christian Bellina, Daniel Piva, Katsuhiko Takahashi, Belligerent and enprop
+1 would like the same, or at least a way to configure this. I add a lot of things to .gitignore (such as certain type of .md files) but want to be able to refer to them as these include instructions for an ongoing task.
quick note on this: it was sort of a head scratcher for me too until i realized the behavior from #206 ; i previously maintained a gitignore in my home directory (dotfiles) and set it up in a way where it would ignore all files by default and i would selectively invert the ignore to pick the files I wanted in my repo.
This had the effect where any repository under ~ would effectively fail to @ mention a file within codex cli, unless it got through that directory .gitinore and the parent .gitignore as it traversed up the home directory.
i fixed my issue by just not having a .gitignore in the parent directory but this behavior is unique to codex cli (other solutions seem to not run into this problem, probably because they only respect .gitignore in current directory and nested ones vs. traversing up the directory tree).
@CarlosCommits can you elaborate with a little more effort, what specific issue you're running into? have you tried the workarounds suggested above? what does your current setup look like. a little more info will help provide more insight to the codex team when they look at this issue. As a start, you can try to answer the same questions that LucasChenZQ did at the start of this thread.
@kaushikgopal there's nothing to elaborate? I'm just saying bump to try to get more attention on this issue. This issue is that Codex currently does not let you @ mention any files that are .gitignored.
Reacted by monosense, Maximilian Krupop, Leonid Korotkevich, Karsten Kerber, deathraceDj, Muhammad Daffa Ashdaqfillah, Nicolo Ceneda, daothinh, Tanmay Nargas, Christian Bellina and 6 more
The root .gitignore intentionally ignores the child repo containers so the root repo does not track embedded repos:
services/
Expected behavior:
When Codex is opened at root-repo, the @ picker should be able to mention files from independently managed nested git repos, or there should be a config setting to include specific ignored directories for mentions, e.g. services/api/**.
This is distinct from wanting to include arbitrary ignored secrets/build output. These child repos are real working trees with their own .gitignore, tracked files, and agent instructions.
Actual behavior:
The root @ picker does not surface files under the child repos because the parent .gitignore ignores the container directory.
The agent can still read the files if explicitly given paths or via shell search, so the issue is specifically file mention autocomplete/discovery.
Why this matters:
Repo-manager setups such as .meta/pseudo-monorepos commonly keep many independent repos under one operational root.
Removing the parent ignore is not a good workaround because the root repo then sees all child repos as untracked directories.
Opening Codex separately in each child repo loses the root orchestration context.
A useful fix would be a repo/workspace config option for @ mentions, such as explicit include globs that override parent .gitignore only for mention discovery, while still keeping default ignore behavior for secrets and generated artifacts.
The root .gitignore intentionally ignores the child repo containers so the root repo does not track embedded repos:
services/
Expected behavior:
When Codex is opened at root-repo, the @ picker should be able to mention files from independently managed nested git repos, or there should be a config setting to include specific ignored directories for mentions, e.g. services/api/**.
This is distinct from wanting to include arbitrary ignored secrets/build output. These child repos are real working trees with their own .gitignore, tracked files, and agent instructions.
Actual behavior:
The root @ picker does not surface files under the child repos because the parent .gitignore ignores the container directory.
The agent can still read the files if explicitly given paths or via shell search, so the issue is specifically file mention autocomplete/discovery.
Why this matters:
Repo-manager setups such as .meta/pseudo-monorepos commonly keep many independent repos under one operational root.
Removing the parent ignore is not a good workaround because the root repo then sees all child repos as untracked directories.
Opening Codex separately in each child repo loses the root orchestration context.
A useful fix would be a repo/workspace config option for @ mentions, such as explicit include globs that override parent .gitignore only for mention discovery, while still keeping default ignore behavior for secrets and generated artifacts.
This is exactly my situation but the .ignore workaround handles it perfectly.
I found a workaround for this. Just creating a .ignore file in your root and "un-ignore" them there.
Most search engines (like ripgrep) prioritize .ignore over .gitignore. Example .ignore:
!path/to/your/ignored_file.js
!.env
This way, Git still ignores the files, but the agent like codex and opencode can "@" them.
Can confirm that using a .ignore to un-ignore seems to be working for my needs.
A working method for the .ignore workaround (keeping files git-ignored while making them searchable via @):
Create a .ignore file in the workspace root.
Un-ignore the parent directory first, then the file:
!ignored/
!ignored/target-file.js
Leave .gitignore untouched — git still ignores the files, while ripgrep-based search now includes them.
The key detail: un-ignoring only the file (!ignored/target-file.js) is not enough when the whole parent directory is git-ignored — ripgrep skips the directory before reaching the file rule. Verified locally with ripgrep 15.2.0: with only the file rule the path stays invisible, and adding the directory rule first (!ignored/) makes it searchable while git check-ignore still reports the path ignored. Independent community workaround; not an official OpenAI fix.
Activity
guidedways commentedon Aug 31, 2025
+1 would like the same, or at least a way to configure this. I add a lot of things to
.gitignore(such as certain type of.mdfiles) but want to be able to refer to them as these include instructions for an ongoing task.efengshan commentedon Sep 20, 2025
I come across the same question, have you solved this problem?
xianghongai commentedon Sep 22, 2025
Documentation is ignored in Git, but is needed in AI.
efengshan commentedon Sep 26, 2025
so I wonder have they solved this problem?
kaushikgopal commentedon Oct 17, 2025
quick note on this: it was sort of a head scratcher for me too until i realized the behavior from #206 ; i previously maintained a gitignore in my home directory (dotfiles) and set it up in a way where it would ignore all files by default and i would selectively invert the ignore to pick the files I wanted in my repo.
This had the effect where any repository under
~would effectively fail to @ mention a file within codex cli, unless it got through that directory .gitinore and the parent .gitignore as it traversed up the home directory.i fixed my issue by just not having a
.gitignorein the parent directory but this behavior is unique to codex cli (other solutions seem to not run into this problem, probably because they only respect.gitignorein current directory and nested ones vs. traversing up the directory tree).CarlosCommits commentedon Nov 1, 2025
bump
kaushikgopal commentedon Nov 1, 2025
@CarlosCommits can you elaborate with a little more effort, what specific issue you're running into? have you tried the workarounds suggested above? what does your current setup look like. a little more info will help provide more insight to the codex team when they look at this issue. As a start, you can try to answer the same questions that LucasChenZQ did at the start of this thread.
CarlosCommits commentedon Nov 1, 2025
@kaushikgopal there's nothing to elaborate? I'm just saying bump to try to get more attention on this issue. This issue is that Codex currently does not let you @ mention any files that are .gitignored.
Molunerfinn commentedon Jan 2, 2026
Need too
jonaswaller commentedon Jan 16, 2026
bump
dheerajawale-svg commentedon Jan 19, 2026
This is issue is becoming bottleneck for me to continue with codex :(
credo-quia-absurdum commentedon Jan 26, 2026
bump
cryptochrome commentedon Jan 26, 2026
How is this still not a thing, half a year later? This should be configurable.
12 remaining items
nicoloceneda commentedon Apr 4, 2026
I agree that this issue needs to be solved. Commenting for visibility.
nk-tedo-001 commentedon Apr 25, 2026
bump
hectorddmx-ap commentedon May 8, 2026
Adding a concrete variant that is especially painful for pseudo-monorepos / nested repo managers.
Environment:
@file mention picker from a root workspaceSetup:
The root
.gitignoreintentionally ignores the child repo containers so the root repo does not track embedded repos:services/Expected behavior:
root-repo, the@picker should be able to mention files from independently managed nested git repos, or there should be a config setting to include specific ignored directories for mentions, e.g.services/api/**..gitignore, tracked files, and agent instructions.Actual behavior:
@picker does not surface files under the child repos because the parent.gitignoreignores the container directory.Why this matters:
.meta/pseudo-monorepos commonly keep many independent repos under one operational root.A useful fix would be a repo/workspace config option for
@mentions, such as explicit include globs that override parent.gitignoreonly for mention discovery, while still keeping default ignore behavior for secrets and generated artifacts.navels commentedon May 8, 2026
This is exactly my situation but the .ignore workaround handles it perfectly.
upnorthmedia commentedon May 16, 2026
This should, at a minimum, be a setting that can be toggled.
kt-devoss commentedon May 20, 2026
@etraut-openai You labeled this issue as an 'Extension', but I think it also applies to TUI and Apps.
rogdex24 commentedon Jun 3, 2026
this is much needed team-codex
carl-lowther commentedon Jun 4, 2026
Can confirm that using a .ignore to un-ignore seems to be working for my needs.
khangtruongfe commentedon Jun 19, 2026
It's work to me, thank you
ntc2 commentedon Jun 26, 2026
@LucasChenZQ or anyone who can edit the issue description: please note the
.ignoreworkaround in the issue description:typhoon93 commentedon Jul 29, 2026
this is such a weird issue and crazy it has been up for so long, anyone working on this at all?
adrianrm commentedon Aug 7, 2026
Can this answer be pinned? This seems to be solve the problem. What I do:
/.git/info/exclude/task-descriptions/.gitignore/.ignoreskovranek commentedon Aug 15, 2026
👍 thanks
naipi11 commentedon Aug 18, 2026
A working method for the
.ignoreworkaround (keeping files git-ignored while making them searchable via @):.ignorefile in the workspace root..gitignoreuntouched — git still ignores the files, while ripgrep-based search now includes them.The key detail: un-ignoring only the file (
!ignored/target-file.js) is not enough when the whole parent directory is git-ignored — ripgrep skips the directory before reaching the file rule. Verified locally with ripgrep 15.2.0: with only the file rule the path stays invisible, and adding the directory rule first (!ignored/) makes it searchable whilegit check-ignorestill reports the path ignored. Independent community workaround; not an official OpenAI fix.martinguenther commentedon Sep 10, 2026
The proposed
.ignoresolution has worked for me too. Here's how Anthropic solved it in Claude Code https://code.claude.com/docs/en/settings-reference#respectgitignore