How do I get a VSCode Remote - Containers devcontainer to use a forwarded SSH Agent for Git credentials?

Viewed 1209

In Microsoft's docs on sharing git credentials with a devcontainer they state:

the extension will automatically forward your local SSH agent if one is running

However:

Locally:

I'm in OSX (Big Sur) and have an ssh agent running.

ssh-add -l gives:

256 SHA256:somelongkeyblahblah me@myemail.com (ED25519)

cat ~/.ssh/config gives:

Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

In the remote container:

echo $SSH_AUTH_SOCK gives:

/tmp/vscode-ssh-auth-0fa193ba528678ff6157458207dbd1facaa44958.sock

ssh-add -l gives:

The agent has no identities.

cat ~/.ssh/config gives:

/bin/cat: /root/.ssh/config: No such file or directory

and ls -al ~/.ssh gives:

total 12
drwxr-xr-x 2 root root 4096 Jul 20 10:29 .
drwx------ 1 root root 4096 Jul 20 10:29 ..
-rw-r--r-- 1 root root  799 Jul 20 10:29 known_hosts

Question

Clearly, my ssh agent isn't being "automatically forwarded". I'm not very experienced in this area - what's my next move? How do I determine if this is due to something I've done, or due to a bug in Remote-Containers?

1 Answers
Related