Skip to content

Tool permissions not recognized when running commands in git worktrees #13019

Description

@tonyjoblin

Description

When working in a git worktree (e.g., ../worktrees/feature-branch), commands that should be auto-approved based on the main project's permission settings still prompt for approval. The permission system appears to check against the original project path rather than recognizing the worktree as part of the same project.

Steps to Reproduce

  1. Have a project at /Users/user/src/project with certain Bash commands configured as auto-approved (e.g., bin/rails test:*)
  2. Create a git worktree: git worktree add ../worktrees/feature-branch
  3. In Claude Code, work in the worktree directory
  4. Run an auto-approved command like bin/rails test test/models/some_test.rb in the worktree
  5. Bug: Permission is requested, referencing the original project path (./) instead of the worktree path

Expected Behavior

Commands run in a git worktree should inherit the permission settings from the main project, since worktrees share the same .git configuration and are part of the same repository.

Actual Behavior

  • Permission prompts appear for commands that should be auto-approved
  • The permission prompt references the original project directory (./) rather than the worktree path (../worktrees/...)

Impact

This breaks the workflow when using git worktrees for parallel development, requiring repeated manual approvals for routine commands.

Environment

  • Claude Code CLI
  • macOS
  • Git worktrees feature

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:securityarea:toolsautocloseIssue will be closed automaticallybugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions