[BUG] @ command includes .git files in autocomplete

Resolved 💬 27 comments Opened Sep 17, 2025 by nCubed Closed Jan 18, 2026
💡 Likely answer: A maintainer (ant-kurt, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The @ command file autocomplete includes git objects and internal git files (e.g., .git/objects/*, .git/refs/*, .git/hooks/*) in the file picker.

<img width="539" height="262" alt="Image" src="https://github.com/user-attachments/assets/f178b18b-a337-4dda-ac14-ae592b3cb78e" />

What Should Happen?

The @ command should exclude .git directory contents from file indexing and autocomplete, similar to how most developer tools ignore git internals.

Error Messages/Logs

N/A - No error messages, just unwanted behavior.

Steps to Reproduce

  1. Open Claude Code CLI in any git repository
  2. Type @ to trigger file autocomplete
  3. Observe that git internal files appear in the list alongside project files

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

1.0.117 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

Additional Context

  • Attempted to exclude via .claude/settings.local.json permissions.deny patterns but this only affects file access, not indexing
  • This clutters the file picker and makes it harder to find actual project files
  • Screenshot available showing the issue

View original on GitHub ↗

27 Comments

github-actions[bot] · 10 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/6412
  2. https://github.com/anthropics/claude-code/issues/5380
  3. https://github.com/anthropics/claude-code/issues/5228

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

nCubed · 10 months ago

The other open issue is for "I can't @my-file/path anymore." - this issue is about the @ command including .git files/artifacts in the autocomplete.

The same issue has been closed multiple times as duplicate, but they referenced issues are not duplicates:

  • #6412
  • #5380
  • #5228
  • #5775

Each of the above issues describe the same behavior, but are incorrectly closed as dup of a different, but related issue.

joanreyero · 10 months ago

+1 on this. The duplicates are incorrectly tagged.

avegancafe · 10 months ago

@nCubed I think @ is just passing through to rg (though for the life of me idk why they don't default to fd), three questions:

  1. do you have any default ripgrep settings that allow searching within .git? Do you have a ~/.config/ripgrep/config file maybe?
  2. what is the output of claude doctor?
  3. do you see any error logs when starting claude with claude --debug and using @?
nCubed · 10 months ago
  1. No ripgrep defined
  2. /doctor - no issues
  3. no errors in debug mode

Same issue in both WSL/Ubuntu and Windows Powershell.

@avegancafe I'm not quit sure if you're implying this does not occur with your instance of Claude Code? Or?

avegancafe · 10 months ago

Yes exactly @nCubed , this isn't happening with my ripgrep, e.g. this screenshot was taken inside of a git repo where there is most definitely a .git/info/ dir:

<img width="732" height="476" alt="Image" src="https://github.com/user-attachments/assets/103bc60a-6d80-4ae8-8bf5-6de2b286922f" />

What does the actual output of claude doctor say though, can you post it? I have a hypothesis but I forget exactly what it says when it's using a borked version of ripgrep

nCubed · 10 months ago
 Diagnostics
 └ Currently running: unknown (1.0.119)
 └ Path: /usr/bin/node
 └ Invoked: /home/ncubed/.npm-global/bin/claude
 └ Config install method: global
 └ Auto-updates enabled: default (true)
 └ Search: OK (vendor)
avegancafe · 9 months ago

@nCubed can you try running USE_BUILTIN_RIPGREP=0 claude, and @ mention files, an see if that works? I'm assuming you have a working version of ripgrep on your computer

nCubed · 9 months ago

@avegancafe - issue remains. However, after a bit of experimentation, the @ stopped indexing .git when I added an ignore file and and rgignore file for .git.

Root of project

printf ".git/\n" >> .ignore
printf ".git/\n" >> .rgignore

_Not sure which one took, but it's good enough for now._

Disclaimer

I do not consider this issue as closed, just a work-around.

avegancafe · 9 months ago

@nCubed with USE_BUILTIN_RIPGREP=0, what does /doctor say now? Does it appropriately find your ripgrep installation?

nCubed · 9 months ago
@nCubed with USE_BUILTIN_RIPGREP=0, what does /doctor say now? Does it appropriately find your ripgrep installation?

Appreciate the assist! I think I'm good w/ this for now. I'll leave this in the hands of the Anthropic team to resolve now.

AnthonyRonning · 9 months ago
@nCubed with USE_BUILTIN_RIPGREP=0, what does /doctor say now? Does it appropriately find your ripgrep installation?

I tried to above tests and also the env variable. My doctor says this on 2.0.1:

> /doctor 

 Diagnostics
 └ Currently running: npm-global (2.0.1)
 └ Path: /nix/store/5xv8h012gkpgnfrw9ms6wkscgxhk1ri1-nodejs-20.19.4/bin/node
 └ Invoked: /home/tony/.npm-global/bin/claude
 └ Config install method: global
 └ Auto-updates enabled: default (true)
 └ Update permissions: Yes
 └ Search: OK (rg)

Nothing above has worked in removing the dotfiles that should be ignored.

avegancafe · 9 months ago

Hm that's so interesting @AnthonyRonning , it says it's using system ripgrep and yet still is returning files that shouldn't be returned by ripgrep by default. You don't have any ~/.config/ripgrep/config or ~/.config/ripgrep/rc or anything?

AnthonyRonning · 9 months ago
Hm that's so interesting @AnthonyRonning , it says it's using system ripgrep and yet still is returning files that shouldn't be returned by ripgrep by default. You don't have any ~/.config/ripgrep/config or ~/.config/ripgrep/rc or anything?

I did a cat on those two files and didn't see anything. This is my version in case it helps:

rg --version
ripgrep 14.1.1

features:+pcre2
simd(compile):+NEON
simd(runtime):+NEON

PCRE2 10.43 is available (JIT is available)
dekdevy · 9 months ago

same issue as @AnthonyRonning - no rg config files for rg at all.
USE_BUILTIN_RIPGREP=0 does not help. i tried installing via npm, as well as bun - same issues
of course arch btw
rg 14.1.1 - and using it manually works as expected - filters ./git properly
.rgignore is the only thing that works

nCubed · 9 months ago

@AnthonyRonning have you tried with the .ignore or .rgignore workaround I posted earlier. Has worked for me and looks like @dekdevy as well.

AnthonyRonning · 9 months ago
@AnthonyRonning have you tried with the .ignore or .rgignore workaround I posted earlier. Has worked for me and looks like @dekdevy as well.

I did the other day. I can try again later. Perhaps it was cached or something? Was it instant for you as soon as you added them and relaunched Claude?

nCubed · 9 months ago
> @AnthonyRonning have you tried with the .ignore or .rgignore workaround I posted earlier. Has worked for me and looks like @dekdevy as well. I did the other day. I can try again later. Perhaps it was cached or something? Was it instant for you as soon as you added them and relaunched Claude?

IIRC, yes. I added the ignore files, relaunched claude. No more .git noise.

AnthonyRonning · 9 months ago

Okay I spent about 15 minutes with claude on my system to get it to work:

  1. Created ~/.ripgreprc config file (via home.nix) with glob exclusions:

--glob=!.git/
--glob=!.svn/
--glob=!.hg/
--glob=!node_modules/
etc...

  1. Important: Don't include --hidden flag in the config, as that causes .git/ to show up even with glob exclusions.
  2. Set environment variables in home.nix under programs.zsh.sessionVariables:

RIPGREP_CONFIG_PATH = "$HOME/.ripgreprc";
USE_BUILTIN_RIPGREP = "0"; # This is the key one!

  1. Restart Claude Code after running update (nixos-rebuild) so it picks up the new environment variables.

Half of my problem was nix specific things but happy to say it works, appreciate the help and pointers!

ant-kurt collaborator · 8 months ago

FYI our next release will be dropping support for custom ripgrep configs in Claude Code. This was unfortunately necessary to prevent some other issues with custom configurations breaking Claude Code.

Can you try the other solutions in this thread, such as the ignore file or using the non-built in ripgrep? If there are still issues, we can look into how to re-enable custom configs with some guardrails around it.

enajx · 8 months ago

This is still a problem. Any solutions or workarounds?

<img width="534" height="229" alt="Image" src="https://github.com/user-attachments/assets/4d51de08-2638-412a-a70c-48959b57226e" />

<img width="682" height="253" alt="Image" src="https://github.com/user-attachments/assets/61bd22d1-9b2c-46c8-a952-9822762a6f3a" />

dekdevy · 8 months ago
FYI our next release will be dropping support for custom ripgrep configs in Claude Code. This was unfortunately necessary to prevent some other issues with custom configurations breaking Claude Code. Can you try the other solutions in this thread, such as the ignore file or using the non-built in ripgrep? If there are still issues, we can look into how to re-enable custom configs with some guardrails around it.

@ant-kurt
im a little bit confused on what the current methods should be, and whether exactly (and when) it broke. im using .rgignore and it is still working on (2.0.30), but without rgignore it is still broken.
can you give an up to date list of actions that users can try and from which version this change happened?

AnthonyRonning · 8 months ago
FYI our next release will be dropping support for custom ripgrep configs in Claude Code. This was unfortunately necessary to prevent some other issues with custom configurations breaking Claude Code. Can you try the other solutions in this thread, such as the ignore file or using the non-built in ripgrep? If there are still issues, we can look into how to re-enable custom configs with some guardrails around it.

If this is going to be the case, then can you just figure out how to exclude unnecessary files correctly?

tal · 8 months ago

This is the commit i made to ignore these user wide if anyone else comes across this bug and wants to know the fix https://github.com/tal/dotfiles/commit/9bcb221033e6abdb0339cbda2b1e02be9953760f

github-actions[bot] · 7 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] · 5 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.