Anyspheres Dev Container Extension doesn’t automatically copy .gitconfig like VS Code does

Hi,

When using Dev Containers in VS Code, the local ~/.gitconfig is automatically copied into the container. This allows Git inside the container to use my user settings seamlessly.

This behavior is described in the official documentation:

However, when using the Dev Container extension in Cursor (provided by Anysphere), this automatic copying doesn’t seem to happen. As a result, Git inside the container doesn’t pick up my user configuration.

Currently, I’m working around this issue by manually adding the following mounts setting to devcontainer.json:

"mounts": [
  "source=${env:HOME}/.gitconfig,target=/root/.gitconfig,type=bind,consistency=cached"
]

It works, but it would be much more convenient if Cursor supported the same automatic behavior as VS Code.

Could you please consider supporting this feature?

1 Like

Hi @Koizumi_Ryo, thanks for sharing this issue and the workaround. We’ll look into adding this feature directly into the devcontainers extension.

2 Likes

Without the workaround, its working partially

git config user.email works correctly
git config user.name doesn’t return anything causing issues

for me the workaround was a different path

"mounts": ["source=${env:HOME}/.gitconfig,target=/home/root/.gitconfig,type=bind,consistency=cached"]

Hi @Koizumi_Ryo and @brainomite, could you upgrade to version 1.0.9 of the Anysphere Remote Containers extension? This version will copy the .gitconfig into the container.

1 Like

@ravirahman At first blush it seems to be working!

It doesn’t seem to work for symlinked files.

$ ls -la .gitconfig 
lrwxr-xr-x@ 1 benis  staff  39 Aug 18  2023 .gitconfig -> /Users/benis/.config/dotdrop/.gitconfig

From the anysphere devcontainer extension log:

2025-07-16 08:00:41.883 [info] Installing remote server in container...
2025-07-16 08:00:41.883 [info] Reading .gitconfig from /Users/benis/.gitconfig
2025-07-16 08:00:41.902 [info] /Users/benis/.gitconfig is not a file, skipping
2025-07-16 08:00:41.902 [info] Reading .gitconfig from /Users/benis/.config/git/config
2025-07-16 08:00:41.925 [error] Failed to read /Users/benis/.config/git/config: EntryNotFound (FileSystemError): /Users/benis/.config/git/config

The vscode Dev Containers extension doens’t have that issue.

Hi @penor, thanks for flagging this issue – we have fixed it in version 1.0.16 of the Anysphere Remote Containers extension. If you were using Docker over WSL, you’ll also need to upgrade to version 1.0.8 of the Anysphere Remote WSL extension.