[BUG] Claude always using cd command into current working directory in combination with Git commands, requiring approval for whitelisted commands
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?
All of Claude git commands uses cd combinaton like:
cd <current working directory> && git ...
So even though I have git commands like git diff etc in my alow list, they all require approval due to "Compound commands with cd and git require approval to prevent bare repository attacks" warning.
En earlier versions, Claude would not pointlessly use cd command with git.
What Should Happen?
cd to current working directory should not trigger warning. Claude should not pointlessly run cd commands to current directory.
Error Messages/Logs
Steps to Reproduce
Work in a git repo, ask Claude to fix some bug. Claude begins running git commands like diff/log etc.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.68 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 15 comments on GitHub. Read the full discussion on GitHub ↗