Skip to content

Allow configuring auto-approval for cd+git compound commands #32985

@luismarcanth

Description

@luismarcanth

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 ` 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions