Description
When the working directory is a git worktree, the .git file contains a relative gitdir: reference to the parent repo’s .git/worktrees/<name> directory. This path does not resolve inside the container, causing all git commands to fail:
fatal: not a git repository: /Users/<user>/<project>/.git/worktrees/<worktree-name>
Repro
- Open a project that is, or becomes, a git worktree.
- Try any git operation from within Claude Code, such as
/commit.
Expected
Git operations work normally.
Actual
All git commands fail because the gitdir path from the host does not exist inside the container filesystem.
Description
When the working directory is a git worktree, the
.gitfile contains a relativegitdir:reference to the parent repo’s.git/worktrees/<name>directory. This path does not resolve inside the container, causing all git commands to fail:fatal: not a git repository: /Users/<user>/<project>/.git/worktrees/<worktree-name>Repro
/commit.Expected
Git operations work normally.
Actual
All git commands fail because the
gitdirpath from the host does not exist inside the container filesystem.