Situation

I've got an internal GitLab that I'm trying to interact with within a devcontainer in VSCode. On my host machine, I use PuTTY's Pageant as my SSH Agent. I'd like to forward my Pageant SSH Agent to my devcontainer, so that within my devcontainer if I use Git, I can perform SSH authentication against the internal GitLab server using the Host's SSH Agent (Pageant).

Notable Restrictions

  1. As this is a devcontainer, I'm not really launching Docker directly to build/run the container file, it's all determined from the .devcontainer files. I think in theory, I could do some jankery with that to pass SSH details there but I'm trying to avoid making changes to the docker configuration stuff as much as possible, as I'm working on a project using an externally-developed devcontainer so it's likely to change from any local changes I might make to make it work locally/in my environment, which I'd have to re-implement any time I pulled from upstream.

  2. I don't have full administrative privileges on this workstation.

  3. Lots of recommendations I find online say to basically start the ssh-agent service, which is a service for the Windows 10+ OpenSSH Client. However, this is not relevant as Pageant is my SSH Agent, not the OpenSSH Client that comes with Windows 10 (and up). Additionally, I cannot start that OpenSSH Client service, as it is not present on my machine and I cannot simply add it to my machine as this is a corporate environment.

Details about my system/environment

Host OS

OS Name: Microsoft Windows 11 Enterprise
Version: 10.0.22621 Build 22621

VSCode

Version: 1.77.3 (system setup)
Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
Date: 2023-04-12T09:16:02.548Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Windows_NT x64 10.0.22621
Sandboxed: No

What I've tried / Troubleshooting

Based on the VSCode documentation, using Pageant as my SSH Agent (instead of the built-in Windows 10+ OpenSSH Client) appears to be possible. I have set an environment variable of SSH_AUTH_SOCK=pageant for my current user. However, when starting my devcontainer, I get the notification that the devcontainer could not connect to the SSH Agent on my host, but it doesn't provide much detail to debug or troubleshoot with.

VSCode devcontainer notification showing that it could not connect to my host's SSH Agent. Specifically, it says "Could not connect to ssh-agent on local host (pageant). Make sure the service is running.".

The notification says "Could not connect to ssh-agent on local host (pageant). Make sure the service is running." Which is strange, because the instructions in the VSCode documentation says that to use Pageant all that I need to do is to set the SSH_AUTH_SOCK environment variable to pageant for it to work. Additionally, I can see that pageant.exe is running within Task Manager.

Screenshot of pageant.exe running within Task Manager

Pageant is also loaded with the SSH Key that I need to authenticate against GitLab, as I can successfully do so from my host machine.

Successfully authenticating to my internal GitLab using plink.exe (the PuTTY SSH client) which uses Pageant as my SSH Agent

Ultimately, it seems that the notification for VSCode is written making the assumption that one is using the built-in Windows 10+ OpenSSH Client; however, I'm not using that, so the notification text is unhelpful, and I cannot find anything else about this, which is why I'm opening this SO post about it.

Thanks in advance, I'll try to edit this question with any additional details as requested.

0

There are 0 best solutions below