VSCode with activated ssh-agent on Windows 10

Viewed 2031

I want to use git from within VSCode, using my ssh-key. My current working fix is this:

  1. start Powershell
  2. run start-ssh-agent.cmd (of git installation)
  3. run code

This links the ssh agent or socket to VSCode, effectively allowing me to use the key for git commands.

How can I turn this into a proper script? Or even better: How do I start and configure the ssh-agent automatically so it's globally available (similar to ssh-add on linux)?

1 Answers

Take a look at this help tip for VS Code: https://code.visualstudio.com/docs/remote/troubleshooting#_setting-up-the-ssh-agent

To summarize, run the following from an administrative PowerShell window:

# Make sure you're running as an Administrator
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
Get-Service ssh-agent

This should set the Windows ssh agent service to start automatically, so that you don't need to enter your password every time.

Related