- Add all private keys to the ssh-agent:
ssh-add -A
- Reboot Docker Desktop
- Reopen VSCode
SSH Keys
should be shared now with the DevContainer
😎
- Restart the ssh-agent:
eval "$(ssh-agent -s)"
- View ssh keys:
ssh-add -l
On macOS, SSH Keys
are not always automatically shared between the host and the DevContainer
. They are lazily added to
the SSH Agent. When they're not added to the SSH Agent, you'll get the following error when trying to execute
git pull
, git push
or git clone
commands in the DevContainer
:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Related issue on vscode-remote-release
: Automatically add SSH keys to ssh-agent