VSCode¶
VSCode is a cross-platform code editor developed by Microsoft. It is free, open source and supports extension plug-ins. Use the Remote plugin to connect to a remote server for development.
install extension¶
Click the Extensions tab in the sidebar, search for the Remote - SSH plugin and click Install. If you need to use the Chinese interface, install the Chinese (Simplified) plug-in, and the Chinese can be displayed after restarting.
Add remote host¶
After installing the extension, click the Remote Explorer tab in the sidebar and click the plus button to add a remote host.
Click Copy Login Command in My Instance.
Paste the copied login instruction and enter Enter.
The remote host information will be saved in the local configuration file, select the first configuration file to complete the addition.
connect to remote host¶
After the addition is complete, the newly added remote host will be displayed in the Remote Explorer. Click the button that opens the connection in a new window.
Select the Linux system in the new pop-up window.
When prompted for the host key fingerprint, select Continue.
Click Copy Login Password in My Instance.
Paste the copied login password and enter Enter.
After a successful connection, click the Explorer tab to display that you are connected to the remote. At the same time, the lower left corner prompts the connected remote host name.
tip
If the connection prompts "The pipe you are trying to write to does not exist", it may be a problem with SSH that comes with Windows. You can install Git, then search for remote.SSH.path
in VSCode Preferences - Settings, fill in C:\Program Files\Git\usr\bin\ssh .exe
tells VSCode to use the SSH client provided by Git.
use remote host¶
Click the question icon in the lower left corner, then click the Terminal tab. An open terminal automatically logs in to the remote server. Use mkdir example
to create a folder for writing code.
Click Open Open Folder, select the example
folder you just created, and click OK.
After opening, the file of the remote host is displayed in the resource manager, and the editing code can be created in the current workspace.
Execute the command in a terminal window to run the code.
When you need to exit when you are done using it, click the blue SSH hostname in the lower left corner. Select Close Remote Connection.
VSCode official documentation: Remote Development using SSH