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
- Run a command that accesses
.git/directly (e.g.,rm -f .git/index.lock) - When prompted, select "Yes, and always allow access to .git/ from this project"
- In a new conversation (or the same session), run another command accessing
.git/ - 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.jsonwork fine and persist correctly - Adding
Bash(rm -f .git/index.lock)orBash(rm -f .git/index.lock:*)to the projectsettings.jsonpermissions.allowarray 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.lockas a pre-flight step)
Environment
- macOS (Darwin 24.6.0)
- Claude Code (latest)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗