Fix for “An SSH Installation Couldn’t Be Found” Error When Connecting to a Remote Server in VS Code

Operating System: Windows 10

When using the Remote-SSH extension in VS Code for remote development, you might encounter the error message “An SSH installation couldn’t be found” during the first connection attempt to a remote server. This error indicates that the VS Code Remote-SSH extension cannot find ssh.exe in your Windows system.

By default, VS Code looks for the ssh command in the system’s PATH environment variable. If it’s not found, this error occurs.

One solution is to install the Git package on your Windows system, which includes ssh.exe. Then, you can specify the exact path to ssh.exe in the settings of the VS Code Remote-SSH extension by configuring the remote.SSH.path option. Here’s how:

  1. Install the Git package, which includes ssh.exe.
  2. In VS Code, press F1 -> type Remote-SSH: Settings and hit Enter. This will open the Remote-SSH configuration file.
  3. Locate the remote.SSH.path option and set its value to the absolute path of ssh.exe on your Windows system. For example:
C:\Programs\Git\usr\bin\ssh.exe

Alternatively, you can install the OpenSSH package, which also includes ssh.exe, and use that instead of the Git-provided version.

VS Code连接远程服务器时弹出an ssh installation couldn’t be found对话框的解决方法

我的操作系统是Windows 10。

在VS Code中安装Remote-SSH扩展进行远程开发,首次连接远程服务器时出现an ssh installation couldn’t be found对话框,该错误表明VS Code Remote-SSH扩展在Windows系统中找不到ssh.exe。

VS Code默认将在PATH环境变量中查找ssh命令,如果找不到,就会出现上述错误。

可以先在Windows系统中安装Git软件包,它会同时安装ssh.exe,然后在VS Code Remote-SSH扩展的设置里,将remote.SSH.path配置项的值设置为ssh.exe在Windows系统里的绝对路径,明确告诉VS Code SSH客户端的位置,具体步骤为:

在VS Code中按下F1键 -> 输入Remote-SSH:Settings后回车,打开Remote-SSH的配置文件 -> 找到remote.SSH.path配置项,填入ssh.exe在Windows系统中的绝对路径,例如:C:\Programs\Git\usr\bin\ssh.exe

除了使用Git软件包包含的ssh.exe外,也可以安装OpenSSH软件包,使用它包含的ssh.exe。