vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

Support SSH IdentityAgent config for DevContainers

Open skrysm opened this issue 10 months ago • 7 comments

The DevContainers extension already supports forwarding the ssh agent via the SSH_AUTH_SOCK environment variable.

It would be great if the extension would also support the IdentityAgent config (in ~/.ssh/config) which serves the same purpose as SSH_AUTH_SOCK.

Motivation: I'm using 1Password as my ssh agent. On macOS, it registers itself as ssh agent via the IdentityAgent config instead of SSH_AUTH_SOCK.

Thus, out of the box, my ssh keys are not forwarded to dev containers. Instead I have to export SSH_AUTH_SOCK before launching vscode - which works, but it's not as seamless as it could be.

Side note: The 1Password ssh agent works without problems on Windows.

skrysm avatar Feb 12 '25 10:02 skrysm

Apparently, setting environment variables for GUI apps is quite the pain on macOS. (Judging from all the StackOverflow questions, it seems that Apple changes/breaks how this works with "every" new macOS version). So, this makes this issue even more important, as there is no easy workaround (that survives a reboot).

skrysm avatar Feb 12 '25 17:02 skrysm

This is a pretty big problem. Has me looking at other IDEs for work.

PeterHindes avatar Feb 18 '25 20:02 PeterHindes

VS Code reads the env variables from your default shell: You can export SSH_AUTH_SOCK from your ~/.zshrc (depending on which shell is your default) on the Mac and that will be picked up after restarting VS Code.

Reading IdentityAgent from the ~/.ssh/config might be difficult because that can be per host.

chrmarti avatar Feb 18 '25 20:02 chrmarti

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@chrmarti

Reading IdentityAgent from the ~/.ssh/config might be difficult because that can be per host.

If it helps I could limit the feature request to just the global IdentityAgent setting.

skrysm avatar Feb 20 '25 11:02 skrysm

:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Apparently, setting environment variables for GUI apps is quite the pain on macOS. [...] So, this makes this issue even more important, as there is no easy workaround (that survives a reboot).

@skrysmanski 1Password recommends this way to set it globally, but as @chrmarti mentioned, setting it in your shell should be enough. It was enough for me, after I set SSH_AUTH_SOCK in my .zshrc (and restarted VSCode), the agent just works for me from inside the devcontainer (even if VSCode was not launched from the terminal).

dklotz avatar May 21 '25 06:05 dklotz