microsoft / microsoft/vscode-remote-release

Experimental worktree support doesn't work when workspaceMount is customized

Open
#11,478 5 comments 2 reactions 1 assignee View on GitHub

@chrmarti is already working on this.

Since Feb 5, 2026.

containers
Dominant language
Dockerfile
Stars
4.2k
Forks
469
Avg merge
1d 1h
Merged PRs (30d)
1

Description

I'm using Dev Containers with the experimental git worktree support setting enabled. My setup is a git worktree that's a sibling to the main repository:

Issue: When my devcontainer.json includes a custom workspaceMount configuration, the experimental worktree feature does not mount the main repository's .git directory. The worktree's .git file references a relative path (e.g., gitdir: ../main-repo/.git/worktrees/my-worktree) that doesn't resolve inside the container.

Reproduction steps:

  1. Create a git worktree as a sibling to the main repository
  2. Have a devcontainer.json inside the worktree with a custom workspaceMount:
{
  "workspaceMount": "source=${localWorkspaceFolder}/../../,target=/workspace,type=bind",
  "workspaceFolder": "/workspace/services/my-service"
}
  1. Enable experimental worktree support
  2. Open the folder in a devcontainer
  3. Git source control doesn't work — the path in the worktree's .git file doesn't exist
    Expected behavior: The experimental feature should detect the worktree and mount the main repository's .git directory even when workspaceMount is customized.

Workaround: Removing the custom workspaceMount configuration allows the experimental feature to work correctly. It appears the feature only auto-mounts the main .git when using the default mount behavior.

(@chrmarti )

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.