[BUG] often uses `git -C`, which is hard to allow-list
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?
Frequently, when Claude tries to do git operations, it uses git -C, e.g.
git -C /path/to/this/project add README.md
That works fine, but it prevents me from writing cross-project allow permissions for git commands.
"allow": [
"Bash(git add:*)",
]
That allow entry won't match because of the intervening -C /path/to/this/project. And allow entries can't contain multiple wildcards.
I've tried adding an instruction to my global CLAUDE.md to no avail.
What Should Happen?
Claude should only use -C if it's doing something outside of the project directory.
Error Messages/Logs
Steps to Reproduce
- open Claude in a directory that has a git repo
- modify a file
- ask Claude to commit the file
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.50
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
Someone else asked the same thing on Reddit about a month ago: https://www.reddit.com/r/ClaudeCode/comments/1qd1dyz/how_do_i_get_cluadecode_to_stop_using_git_c_for/
This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗