Trying to use git with ssh keys within the devcontainer (git extension or terminal) does not work.
In a terminal in VSCodium connected to a devpod container typing ssh-add -l should show the list of my loaded ssh keys passed through from my host machine. But it is not able to show anything, it seems that there is a local ssh agent running instead of the forwarding to the host machine.
Further investigation was even more irritating, when investigating the devpod with ssh project.devpod and then typing ssh-add -l (within the container terminal) I was able to verify that in fact the devpod itself forwards the ssh related stuff from my host machine.
This left me confused since I assumed that I only connect to the container itself and all things in VSCodium from then on are executed directly within the container (like I did with connecting manually into the container while troubleshooting).
tl;dr
ssh-add -l shows different results depending on the way I am connected to the DevPod container.
| machine |
command |
result |
| host |
ssh-add -l |
Key ABC |
| devpod container (connected via ssh shell) |
ssh-add -l |
Key ABC |
| VSCodium devpod container session terminal |
ssh-add -l |
Error connecting to agent: No such file or directory |
The user within the container is root, and it is in fact the same (and only) container I can connect to, so I expected the same resuts.
Trying to use git with ssh keys within the devcontainer (git extension or terminal) does not work.
In a terminal in VSCodium connected to a devpod container typing
ssh-add -lshould show the list of my loaded ssh keys passed through from my host machine. But it is not able to show anything, it seems that there is a local ssh agent running instead of the forwarding to the host machine.Further investigation was even more irritating, when investigating the devpod with
ssh project.devpodand then typingssh-add -l(within the container terminal) I was able to verify that in fact the devpod itself forwards the ssh related stuff from my host machine.This left me confused since I assumed that I only connect to the container itself and all things in VSCodium from then on are executed directly within the container (like I did with connecting manually into the container while troubleshooting).
tl;dr
ssh-add -lshows different results depending on the way I am connected to the DevPod container.ssh-add -lssh-add -lssh-add -lError connecting to agent: No such file or directoryThe user within the container is
root, and it is in fact the same (and only) container I can connect to, so I expected the same resuts.