How do I make Claude Code access gitignored files like local notes with @-mentions?
Claude Code respects .gitignore, so gitignored files such as private notes do not appear in @-mention autocomplete and are not surfaced for general file awareness. A user wants a local folder kept out of git to remain usable by Claude Code. Is there a supported way to make gitignored files visible?
Originally asked on GitHub: https://github.com/anthropics/claude-code/issues/5105
3 answers
Status: the issue is marked closed (COMPLETED) in the tracker, but the thread does not show a fix or a maintainer explanation. A later commenter reports that gitignored files are still not shown in @ autocomplete, so treat the problem as unresolved.
The only workaround in the thread is for personal files that you want ignored in every repository: put those patterns in a global gitignore file instead of the project .gitignore. A commenter says Claude Code does not read that global file, so files ignored there stay accessible to it, while git still hides them from status output. This is the commenter's report and the thread does not confirm it with a maintainer.
Other proposals were suggested but none is reported as working: a
.claudeignorefile with a!tasks/negation pattern, and a.claudeallowfile that re-includes gitignored folders such astasks/. The thread does not show either being implemented.A commenter also reports the reverse problem: generated code that is gitignored may be hidden from Claude Code, which reduces its usefulness for type lookups.
General advice: Claude Code can read files it is allowed to access, so avoid putting credentials in files you want it to see.
Did this work for you?What @nicksergeant tried on GitHub (Outcome unclear)
A commenter proposed a
.claudeallowfile listing gitignored folders such astasks/so they appear in autocomplete and can be read, while leaving.gitignoreunchanged. No one reports trying it.Source: https://github.com/anthropics/claude-code/issues/5105#issuecomment-3152526111 (opens external site)
Did this work for you?What @jraczynski tried on GitHub (Outcome unclear)
A commenter suggested moving personal ignore patterns into a global gitignore file, saying Claude Code does not read it so those files remain accessible to Claude while git ignores them. The commenter did not report a verified result.
Source: https://github.com/anthropics/claude-code/issues/5105#issuecomment-3223229782 (opens external site)
Did this work for you?