'vscode remote ssh connection cannot connect on windows server 2022

I'm trying to setup Remote SSH extension on vscode to connect to a server that runs Windows Server 2022.

First, I can connect with SSH from the terminal ssh username@public_ip -p port then I enter the password and I can access the server.

I installed the Remote - SSH extension on vscode. I was able to connect to a Raspberry Pi without problems... But I cannot connect to a Windows Server 2022.

It asks me to enter the username password twice, then after a few seconds it stops with two errors pop-ups (see picture below).

Could not fetch remote environment

Failed to connect to the remote extension host server (Error: WebSocket close with status code 1006)

errors

Also, from another machine. I can connect to my server with vscode and the same extension (Windows Server 2022) without any problems so I don't think that the server has any issues. Seems like the problem is on my computer that won't connect. I was able to connect once but I did break something and I don't know what. I tried to reinstall the extension but nothing helped.

EDIT: I think I fixed it.

Here's what I did.
I uninstalled the Remote - SSH extension
I opened the settings.json on my local computer and deleted everything that had to do with this extension.
Deleted the config file from C:\Users\username\.ssh\config
I restarted vscode
Installed the extension
And it worked.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source