简体   繁体   中英

Unable to connect through SSH with VS-Code in Mac to a remote GCP VM

I have created a compute engine instance (Debian) in GCP with a public and private key and able to SSH it from my local mac using the command given below.

I have some folders and files in the remote machine which I would like to edit through VS-code (Version: 1.56.1) installed in my local. But when I try to connect it through VS code as per the instructions in manual using this command

ssh -i ~/.ssh/<filename> username@ipaddress

在此处输入图像描述

I am getting the below error:

在此处输入图像描述

What can I try to fix it?

It looks to be a specific error from VScode and Remote SSH extension. In some cases it worked when the time out value was increased and when the parameter useLocalServer was set to false ( remote.SSH.useLocalServer": false ) under VScode settings. Also try upgrading the version for VSCode and see if the issue mitigates.

To edit folders and files in the remote machine through VS-code you can Connect to a remote host.

Steps to connect to a remote host:

  1. Verify you can connect to the SSH host by running the following command from a terminal.

     ssh user@hostname
  2. In VS Code, select Remote-SSH: Connect to Host, from the Command Palette and use the same user@hostname as in step 1.

  3. If VS Code cannot automatically detect the type of server you are connecting to, you will be asked to select the type manually.

  4. After a moment, VS Code will connect to the SSH server and set itself up. VS Code will keep you up-to-date using a progress notification and you can see a detailed log in the Remote - SSH output channel.

  5. After you are connected, you'll be in an empty window. You can always refer to the Status bar to see which host you are connected to.

  6. You can then open any folder on the remote machine using File > Open. From here, install any extensions you want to use when connected to the host and start editing.

Refer Connect to remote host for information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM