- 1 year ago
How can I use Windows' built-in OpenSSH ssh-agent in VS Code, instead of Git bash's?
To use Windows' built-in OpenSSH ssh-agent in Visual Studio Code instead of Git Bash's ssh-agent, you can follow these steps:
Install OpenSSH: Ensure that you have OpenSSH installed on your Windows machine. You can install it from the Windows Settings or through the command line using the following command:
winget install openssh
Configure Visual Studio Code: Open Visual Studio Code and go to the settings by clicking on File -> Preferences -> Settings (or using the shortcut Ctrl + ,). This will open the User Settings tab.
Configure SSH Path: In the User Settings tab, search for "ssh.path" and update the value with the path to the OpenSSH ssh.exe binary. By default, it is located in
C:\Windows\System32\OpenSSH\ssh.exe
.Example:
swift"ssh.path": "C:\\Windows\\System32\\OpenSSH\\ssh.exe"
Disable Git SSH Agent: To prevent Git from using its own SSH agent (e.g., Git Bash's ssh-agent), you need to disable it by setting the
GIT_SSH
environment variable to an empty value.Example:
json"terminal.integrated.env.windows": {
"GIT_SSH": ""
}
Note: Make sure you don't have any other environment variable overriding the
GIT_SSH
variable.Save the Changes: Save the User Settings file.
After making these changes, Visual Studio Code will use the Windows OpenSSH ssh-agent for SSH authentication. You can now use the integrated terminal in Visual Studio Code with the OpenSSH ssh-agent for SSH operations.
Make sure you have your SSH keys configured correctly and loaded into the ssh-agent for successful authentication.