Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Unexpected workspaceFolder mount behavior when dev container is opened before Git initialization

Đang mở
#1,055 2 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@v-Kaniska244 đang làm issue này rồi.

Từ ngày 6/8/2025.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

I've encountered a strange and hard-to-debug behavior when using multiple devcontainer.json files in a monorepo setup.

Steps to Reproduce
  1. Create a new directory (not yet initialized as a Git repository).
  2. Add a .devcontainer folder in the root with multiple devcontainer.json files, each specifying a different workspaceFolder to scope the dev container to a project in the monorepo.
  3. Open one of the devcontainers in VS Code before initializing the root directory as a Git repository.
  4. Observe that the workspace folder is mounted incorrectly — the parent folder is mounted instead of the expected project directory.
  5. Now run git init in the root of the repo.
  6. Reopen the devcontainer. Everything now works as expected, with the workspaceFolder correctly 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.

Ngôn ngữ chính
TypeScript
Star
3k
Fork
463
Merge trung bình
13 giờ 28 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của devcontainers/cli

Tất cả issue của devcontainers/cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.