Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

--mount-git-worktree-common-dir silently ignored when devcontainer.json sets a custom workspaceMount

オープン
#1,243 コメント 1 件 リアクション 1 件 担当者 1 名 GitHub で見る

@v-Mathiyarasy がすでに取り組んでいます。

2026年6月11日 から。

評価

この issue はまだ評価されていません。

説明

Summary

--mount-git-worktree-common-dir (added in #1127) has no effect when the devcontainer.json defines a custom workspaceMount. The worktree common-dir bind mount is never added, so in-container git fails with fatal: not a git repository for any git worktree whose devcontainer uses a custom workspaceMount.

Root cause

In src/spec-node/utils.ts (getWorkspaceConfiguration, ~L386) the entire worktree detection + common-dir mount block is guarded by:

if (workspace && (!workspaceFolder || !('workspaceMount' in config))) { ... }

When workspaceMount is present, the block is skipped — the .git file is never read, the common dir is never resolved, and no mount is added. (Flagged as a possible oversight by @kapouer in #796, Mar 2026.)

Reproduction (CLI 0.82.0, git 2.52)
  1. git init main && (cd main && git commit --allow-empty -m init && git worktree add --relative-paths ../wt)
  2. Add wt/.devcontainer/devcontainer.json with a custom workspaceMount, e.g.:
    { "image": "mcr.microsoft.com/devcontainers/base:debian",
      "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind",
      "workspaceFolder": "/workspace" }
    
  3. devcontainer up --workspace-folder wt --mount-git-worktree-common-dir true
  4. devcontainer exec --workspace-folder wt -- git -C /workspace status → fatal: not a git repository: (null)
  5. docker inspect on the container shows only the workspace bind mount; the worktree common dir was not mounted.

Removing workspaceMount makes it work — confirming the guard is the cause.

Expected

The common-dir mount should be computed and added even when a custom workspaceMount is set, by resolving the mount target relative to the configured workspaceMount target / workspaceFolder. This is the common case for monorepos that mount a parent directory and set workspaceFolder to a subpath. Relates to #796.

Workaround

Adding the common dir manually via a mounts entry (binding the main repo's .git to the path the worktree's .git file resolves to inside the container) restores in-container git — matching the maintainer's earlier suggestion in #796.

主要言語
TypeScript
スター
3k
フォーク
461
平均マージ
18分
マージ済み PR(30日)
5

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

devcontainers/cli のほかの issue

devcontainers/cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。