[BUG] Global settings.json permissions not applied in git worktrees inside .git/ paths

Resolved 💬 1 comment Opened Feb 18, 2026 by thomast8 Closed Feb 18, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

repo/.git/phantom/worktrees/feature/my-branch/), global permissions from ~/.claude/settings.json are not applied. Every Edit, Write, and
compound Bash command triggers a permission prompt, even though those operations are explicitly allowed in the global settings.
Granting "Allow Always" writes to the worktree's local settings, but the global permissions are never loaded in the first place. This
appears to be caused by project root detection having special handling for .git directories that breaks when the working directory is
physically inside a .git/ path.

What Should Happen?

Global permissions from ~/.claude/settings.json should apply regardless of whether the working directory is inside a .git/ path. Git
itself handles worktrees inside .git/ correctly — git rev-parse --show-toplevel returns the worktree path and the worktree's .git file
correctly points to the real git dir.

Error Messages/Logs

Steps to Reproduce

  1. Add broad permissions to ~/.claude/settings.json:

{
"permissions": {
"allow": [
"Edit(//Users/username/**)",
"Bash(git:*)",
"Bash(echo:*)"
]
}
}

  1. Verify these permissions work in any normal repo directory (no prompts for edits or allowed bash commands).
  2. Create a git worktree inside the .git directory. Tools like https://github.com/nicholasgasior/phantom do this by default, but you can

reproduce manually:
git worktree add .git/phantom/worktrees/feature/test-branch -b test-branch

  1. Open Claude Code in that worktree:

cd /path/to/repo/.git/phantom/worktrees/feature/test-branch
claude

  1. Ask Claude to edit any file or run a compound command like git status && echo done.
  2. Observe that every operation triggers a permission prompt despite being allowed globally.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.45

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗