Skip to content

[BUG] Bash(git commit:*) in allowedTools during claude -p mode isn't respected. #1520

Description

@lukebergmh

Environment

  • Platform (select one):
    • Anthropic API
    • AWS Bedrock
    • Google Vertex AI
    • Other:
  • Claude CLI version: claude --version
    1.0.9 (Claude Code)
  • Operating System: macOS 15.5
  • Terminal: iterm2

Bug Description

Reading the claude documentation here: https://www.anthropic.com/engineering/claude-code-best-practices
It says:
"Bash(git commit:*) to allow git commits" but that isn't respected in claude -p mode.

I'm on a git branch with some staged changes (which Claude was able to do), but when trying to get claude -p to commit the changes to the branch I get an error.
My command line:
echo "Please git commit the changes in the current branch" | claude -p --output-format json --allowedTools "Read,Write,Bash(ls),Bash(git:),Bash(git commit:),Grep"

If I run claude --resume to see the session I see the following error:
⏺ Bash(git commit -m "<commit message"
⎿  Error: Claude requested permissions to use Bash, but you haven't granted it yet.

Steps to Reproduce

  1. Have a branch with staged changes
  2. echo "Please git commit the changes in the current branch" | claude -p --output-format json --allowedTools "Read,Write,Bash(ls),Bash(git:),Bash(git commit:),Grep"
  3. Check the branch and the resumed session to see the error message

Expected Behavior

Bash permissions should be accepted for git commit from either git:* or git commit:*.

Actual Behavior

Claude refuses to run git commit due to permissions.

Additional Context

It does manage to run git push, git pull, git branch, etc, but not git commit for some reason.
I have a similar problem with "gh pr create" but this is the most obvious issue and the documentation says it should work explicitly.

Metadata

Metadata

Assignees

Labels

api:vertexIssue relates to GCP Vertexarea:securityarea:toolsautocloseIssue will be closed automaticallybugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions