claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Git commit permission prompt appears repeatedly despite allow tools configuration

Open noughts opened this issue 7 months ago • 14 comments

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

  1. Configure git commit in both global and project settings files
  2. Attempt to commit changes using git commit
  3. 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 allowedTools shows 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

  1. Both configuration files exist and contain valid JSON
  2. Both files explicitly include "Bash(git commit:*)" in permissions.allow
  3. Other git commands in the same allow lists work correctly
  4. Only git commit triggers permission prompts despite proper configuration

noughts avatar May 31 '25 04:05 noughts

I hate to ask, but did you manage to figure out how to get this to work as expected?

Satal avatar Jun 07 '25 12:06 Satal

I am using the latest version of Claude Code and the situation remains the same.

noughts avatar Jun 10 '25 15:06 noughts

I also encountered this bug. I think this bug can be solved by Claude Code himself.

ishowshao avatar Jun 12 '25 16:06 ishowshao

They should build automated processes to identify and fix issues automatically.

ishowshao avatar Jun 12 '25 16:06 ishowshao

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.

sijiaoh avatar Jun 12 '25 22:06 sijiaoh

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!

dfdeagle47 avatar Jun 13 '25 09:06 dfdeagle47

Seems like a prompt-improvement-tunity

wolffiex avatar Jun 18 '25 00:06 wolffiex

Same problem

cafesao avatar Jun 27 '25 14:06 cafesao

Same issue

codella avatar Aug 12 '25 20:08 codella

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

reorx avatar Aug 17 '25 14:08 reorx

@sijiaoh How on earth did you figure that out? Amazing. 👏

Flamenco avatar Aug 17 '25 16:08 Flamenco

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.

github-actions[bot] avatar Dec 04 '25 10:12 github-actions[bot]

Still occuring

GeoLi23 avatar Dec 11 '25 17:12 GeoLi23