Permission for .git/ directory access not persisted after selecting 'always allow'

Resolved 💬 3 comments Opened Feb 23, 2026 by knchst Closed Feb 26, 2026

Description

When a Bash command accesses the .git/ directory directly (e.g., rm -f .git/index.lock), Claude Code prompts with:

Do you want to proceed?
1. Yes
2. Yes, and always allow access to .git/ from this project
3. No

Selecting option 2 ("Yes, and always allow access to .git/ from this project") does not persist. The next time a command accesses .git/, the same prompt appears again.

Steps to Reproduce

  1. Run a command that accesses .git/ directly (e.g., rm -f .git/index.lock)
  2. When prompted, select "Yes, and always allow access to .git/ from this project"
  3. In a new conversation (or the same session), run another command accessing .git/
  4. The permission prompt appears again

Expected Behavior

After selecting "always allow access to .git/ from this project", the permission should be persisted (presumably in .claude/settings.json or .claude/settings.local.json) and not prompt again.

Actual Behavior

The permission is not saved. The prompt reappears every time.

Notes

  • Command-level permissions (e.g., Bash(git status:*)) in .claude/settings.json work fine and persist correctly
  • Adding Bash(rm -f .git/index.lock) or Bash(rm -f .git/index.lock:*) to the project settings.json permissions.allow array does not help either — the directory-level access check seems to be a separate layer
  • This is particularly disruptive for automated workflows (e.g., custom slash commands that include rm -f .git/index.lock as a pre-flight step)

Environment

  • macOS (Darwin 24.6.0)
  • Claude Code (latest)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗