[BUG] Claude Code cli agent fails to ignore .git/ directory

Resolved 💬 3 comments Opened Oct 26, 2025 by vsh-7cb Closed Oct 30, 2025

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?

<img width="1009" height="1054" alt="Image" src="https://github.com/user-attachments/assets/44073b41-0a34-488c-8520-d99acb8c7edc" />

Claude code cli agent fails to ignore the .git directory.
So whenever I want to reference @src/app/main.py by simply doing @main.py and getting the suggestion, the results are murked by @.git/refs/heads/main.

as u can see I tried permissions.deny in the global and repo settings but it still fails.

The extension successfully filters it out, but I prefer the cli.

Also when I add .git/** in the .gitignore that is when it successfully ignores it, but one does not want to push that update into origin.

What Should Happen?

Claude code cli should ignore .git/**

Error Messages/Logs

Steps to Reproduce

Just type @main

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.27

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗