Skip to content

Git operations fail in worktree-based repositories inside container #1

@pythonlearner1025

Description

@pythonlearner1025

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

  1. Open a project that is, or becomes, a git worktree.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions