Unexpected workspaceFolder mount behavior when dev container is opened before Git initialization
@v-Kaniska244 ci sta già lavorando.
Dal 6/8/2025.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
I've encountered a strange and hard-to-debug behavior when using multiple devcontainer.json files in a monorepo setup.
Steps to Reproduce
- Create a new directory (not yet initialized as a Git repository).
- Add a
.devcontainerfolder in the root with multipledevcontainer.jsonfiles, each specifying a differentworkspaceFolderto scope the dev container to a project in the monorepo. - Open one of the devcontainers in VS Code before initializing the root directory as a Git repository.
- Observe that the workspace folder is mounted incorrectly — the parent folder is mounted instead of the expected project directory.
- Now run
git initin the root of the repo. - Reopen the devcontainer. Everything now works as expected, with the
workspaceFoldercorrectly mounted.
🧠 Expected Behavior
The specified workspaceFolder should be mounted correctly, even if the root directory hasn't been initialized as a Git repository.
😕 Actual Behavior
Before Git initialization, the mount behavior is incorrect — it mounts the parent directory instead of the specified workspaceFolder. This is confusing and difficult to diagnose.
💥 Impact
This behavior makes it hard to use dev containers in new projects or automation scripts that generate dev containers before initializing Git. It also leads to unexpected mount paths, which can break tooling, scripts, or assumptions about paths inside the container.
✅ Suggested Fix
The logic determining the workspaceFolder mount should not depend on whether the folder has been initialized as a Git repository. If Git initialization is required for some internal behavior, it should at least produce a warning or fallback gracefully.
Let me know if you'd like logs or a minimal repro repo — happy to provide more detail if needed.
- Lingua principale
- TypeScript
- Stelle
- 3k
- Fork
- 461
- Merge medio
- 18m
- PR unite (30g)
- 5
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di devcontainers/cli
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
devcontainers/cli#1203 ·
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 68/100
devcontainers/cli#1178 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
devcontainers/cli#1308 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
devcontainers/cli#1307 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
devcontainers/cli#1305 ·
Tutte le issue di devcontainers/cli
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
bug v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelcontextprotocol/inspector#2458 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
carbon-design-system/ibm-products#9907 ·