-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Description:
Currently, when I launch a dev container, I encounter Permission denied (publickey) errors when attempting to perform Git operations. This issue stems from the ~/.ssh/ directory within the dev container being empty, as it is not automatically mounted or linked to my host's SSH configuration.
On the host machine, Git operations function correctly, as my SSH keys are properly set up in ~/.ssh/. To maintain a seamless workflow and avoid reconfiguring SSH within each dev container, it would be highly beneficial if the dev container environment could automatically leverage the host's SSH agent or mount the ~/.ssh/ directory.
Steps to Reproduce:
- Ensure SSH keys are configured in
~/.ssh/on the host. - Build and enter the dev container.
- Execute any Git command that requires authentication (e.g.,
git fetch,git push).
Expected Behavior:
Git commands within the dev container should authenticate successfully using the host's SSH keys, without requiring manual setup inside the container.
Actual Behavior:
Git commands fail with an authentication error: Permission denied (publickey).
Potential Solutions (if applicable):
- Automatically mount
~/.ssh/from the host, e.g. adding todevcontainer.jsonsomething like
"runArgs": [
"-v", "${localEnv:HOME}${localEnv:USERPROFILE}/.ssh:/home/vscode/.ssh"
]
- Integrate with the host's SSH agent.