Since Putty version 0.77, you don't need to use "wsl-ssh-pageant" nor PLINK anymore.
It makes using pageant as ssh-agent for git in vscode much simpler.
<= Windows 10 : follow full instructions
>= Windows 11 : just ignore setting the environment variable GIT_SSH
Preconditions:
- Putty / Pageant >= Version 0.77 and start with new command
pageant.exe --openssh-config %USERPROFILE%\.ssh\pageant.conf
. It generates a file, that directs ssh to pageant, if it is included in .ssh\config. Please note: Resulting file is bound to running pageant.exe instance and changes with every time you start it!!! Easiest way is to include it in your autostart, where you can also add your private keys.
- Correct OpenSSH Pubkey is loaded in git. (Pubkey in Putty-format
.ppk
doesn't work!)
- Corresponding OpenSSH Private-Key is loaded in pageant.
- Create file "%USERPROFILE%\.ssh\config" and add following line
include "pageant.conf"
. It will load the by pageant generated file for direction to pageant.
- Not in Win11!: For vscode, Environment variable
GIT_SSH
must direct to Windows ssh executable, which is usually in C:\Windows\System32\OpenSSH\ssh.exe
. To set this permanently even on systems restricted by administrator: in Powershell execute
[Environment]::SetEnvironmentVariable("GIT_SSH", "$((Get-Command ssh).Source)", [System.EnvironmentVariableTarget]::User)
It will add a permanent user specific environment variable, that can be used by vscode (see in registry under Computer\HKEY_CURRENT_USER\Environment\GIT_SSH
)
Now test git access from command line, to see if ssh access to your git-repo works properly.
Open a fresh cmd
prompt. If following command works similar, all would be fine:
C:\Users\<myuser>> ssh -T git@<your-git-url-goes-here>
Welcome to GitLab, @<your username in git>!
If it works like this, you can start trying git in vscode. But don't forget to restart vscode.