Allow configuring auto-approval for cd+git compound commands
Feature Request
Claude Code currently shows an approval prompt for compound shell commands that chain \cd\ with \git\ operations, with the message: "Compound commands with cd and git require approval to prevent bare repository attacks."
This safety check is valuable, but there is no way to configure it as auto-approved for trusted project directories or globally.
Desired Behavior
Add a setting (e.g., in \.claude/settings.json\) to whitelist or auto-approve \cd\ + \git\ compound commands, similar to how other tool permissions can be pre-approved:
\\\json\
{
"permissions": {
"allow": ["Bash(cd * && git *)"]
}
}
\\
Workaround
Use absolute paths and \git -C <path>\ instead of \cd\ + command chains, but this is less ergonomic and requires changing habits.
Context
Came up during a multi-step build session where many commands ran in a subdirectory alongside git operations. Having to approve each one interrupts the flow significantly.
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗