The solution to the unstable remote ssh connection of vscode

1 Description of the problem

It is very unstable when using the remote ssh plug-in of vscode to remotely connect to the server, and it is very troublesome to change the code.

2 Reason analysis

When the terminal pings the IP of the server, it shows that there is no packet loss. Using ssh in winscp and MobaXterm can also connect to the server normally and stably. This indicates that the problem lies in the ssh connection of vscode, and the openssh that comes with windows is not compatible with vscode.

3 solutions

method one

Install other versions of openssh, I haven't tried this method yet.

Method Two

Use the ssh that comes with git to replace openssh. Git download URL:

After installing git, configure the git environment variable, and add "C:\Program Files\Git\usr\bin" (the path of this file varies from person to person, depending on the path where you installed git) to the path of the system variable, There are also requirements for the placement location, which needs to be placed in front of openssh, as shown in the figure below,

method three

Change the path in remote ssh in vscode to the path of ssh in git, such as: C:\Program Files\Git\usr\bin,

Find remote ssh in the extension plug-in of vscode, and select Settings -> extension settings

Find the remote ssh path, and fill in the ssh path of git,

Guess you like