Anysphere dev containers postCreateCommand not working as expected

Describe the Bug

I am using postCreateCommand to automatically clone a private git repository that requires credential.

devcontainer.json: “postCreateCommand”: “sudo -E git clone $git_repo $workspace/$repo_name”

However, it is not able to get my credentials
fatal: could not read Username for ‘https://github.com’: No such device or address

same command works when creating container without postCreatCommand and running the command after creating.

Steps to Reproduce

devcontainer.json: “postCreateCommand”: “sudo -E git clone $git_repo $workspace/$repo_name”

Expected Behavior

Git repository should be cloned

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.2.2
VSCode Version: 1.99.3
Commit: faa03b17cce93e8a80b7d62d57f5eda6bb6ab9f0
Date: 2025-07-07T06:08:52.104Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.3.0

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hi @Dahyun_Jeon, – credentials are not currently forwarded when running the postCreateCommand. Could you clone manually after starting the container, or clone locally and use a mount for the repository?

Hi, I am currently walking around this issue by manually running the postCreateCommand in the container.
However it is little bit frustrating, moving from automated workflow to manual workflow.

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.