Git commit permission prompt appears repeatedly despite allow tools configuration
Issue Description
Git commit permission prompt appears every time despite properly configuring git commit in BOTH global and project-local settings files.
Steps to Reproduce
- Configure git commit in both global and project settings files
- Attempt to commit changes using git commit
- Permission prompt appears every time despite the configuration
Expected Behavior
Permission prompt should not appear when git commit is listed in permissions.allow.
Actual Behavior
Permission prompt appears repeatedly for every git commit operation, ignoring both global and project-local settings.
Environment
- Platform: macOS
- OS Version: Darwin 24.5.0
- Date observed: 2025/5/31
- Claude Code model: claude-opus-4-20250514
Current Configuration
claude config list output:
{
"allowedTools": [],
"dontCrawlDirectory": false,
"hasTrustDialogAccepted": true,
"hasCompletedProjectOnboarding": true
}
Global settings (~/.claude/settings.json):
{
"permissions": {
"allow": [
"Bash(git for-each-ref:*)",
"Bash(git branch:*)",
"Bash(rg:*)",
"Bash(grep:*)",
"Bash(pnpm run check:*)",
"Bash(git add:*)",
"Bash(git push:*)",
"Bash(pnpm test:*)",
"Bash(npx vitest:*)",
"Bash(find:*)",
"Bash(pnpm run test:unit:*)",
"Bash(rm:*)",
"Bash(mv:*)",
"Bash(git commit:*)",
"Bash(git checkout:*)",
"Bash(gh pr create:*)",
"Bash(git fetch:*)",
"Bash(git reset:*)",
"Bash(pnpm install:*)",
"Bash(cat:*)",
"Bash(curl:*)"
],
"deny": []
},
"model": "opus"
}
Project-local settings (.claude/settings.local.json):
{
"permissions": {
"allow": [
"Bash(git for-each-ref:*)",
"Bash(git branch:*)",
"Bash(rg:*)",
"Bash(grep:*)",
"Bash(pnpm run check:*)",
"Bash(git add:*)",
"Bash(git push:*)",
"Bash(pnpm test:*)",
"Bash(npx vitest:*)",
"Bash(find:*)",
"Bash(pnpm run test:unit:*)",
"Bash(rm:*)",
"Bash(mv:*)",
"Bash(git commit:*)",
"Bash(git checkout:*)",
"Bash(gh pr create:*)",
"Bash(git fetch:*)",
"Bash(git reset:*)",
"Bash(pnpm install:*)"
],
"deny": []
},
"enableAllProjectMcpServers": false
}
Additional Context
- Git commit is explicitly listed in BOTH global and project-local settings files as "Bash(git commit:*)"
- Other git commands (like add, push, checkout) work without permission prompts
- The legacy
claude config add allowedToolsshows a deprecation warning, confirming settings.json is the correct method - Settings are being read correctly as other allowed commands work without prompts
- This appears to be a bug specific to git commit command permissions
Steps to Verify
- Both configuration files exist and contain valid JSON
- Both files explicitly include "Bash(git commit:*)" in permissions.allow
- Other git commands in the same allow lists work correctly
- Only git commit triggers permission prompts despite proper configuration
I hate to ask, but did you manage to figure out how to get this to work as expected?
I am using the latest version of Claude Code and the situation remains the same.
I also encountered this bug. I think this bug can be solved by Claude Code himself.
They should build automated processes to identify and fix issues automatically.
Asking Claude Code to use single quotes instead of double quotes in the git commit command should fix the issue.
Edit: If this alone doesn't resolve the issue, forbidding the use of $() should further improve things.
Asking Claude Code to use single quotes instead of double quotes in the git commit command should fix the issue.
Indeed, works on my end:
Can you commit the staged files? Be sure to use single quotes instead of double quotes like git commit -m '<message>' instead of git commit -m "<message>".
Thanks for the tip!
Seems like a prompt-improvement-tunity
Same problem
Same issue
same here, tried many things including specify git permissions in both .claude/settings.loca.json and ~/.claude/settings.json, tell the agent not to confirm git commit message in prompt or slash command
@sijiaoh How on earth did you figure that out? Amazing. 👏
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Still occuring