secure devcontainer requires host ~/.gitconfig to exist

Open 💬 0 comments Opened Jun 1, 2026 by bar-d

What happened?

.devcontainer/devcontainer.secure.json unconditionally bind-mounts the host user's ~/.gitconfig into the container:

"source=${localEnv:HOME}/.gitconfig,target=/home/vscode/.gitconfig,type=bind,readonly"

For users who do not have a host ~/.gitconfig, Docker-style bind mounts using --mount can fail when the source path does not exist. If an implementation materializes the missing source as a directory, the container-side Git setup can also be confused because .devcontainer/post_install.py conditionally includes /home/vscode/.gitconfig in .gitconfig.local when that path exists.

This makes the secure devcontainer depend on a host file that may not be present in clean environments.

Expected behavior

The secure devcontainer should not hard-require a host ~/.gitconfig. It could make the mount optional, document the prerequisite, or mount a generated/empty config file only when the host file exists.

Additional context

I searched open issues and PRs for terms including devcontainer.secure.json, .gitconfig, gitconfig.local, and bind-mount source path behavior, and did not find an existing open item that appears to cover this setup issue.

View original on GitHub ↗