VScode Remote SSH remote editing and debugging code

VScode Remote SSH remote editing and debugging code

The latest Insider version of Visual Studio Code has added the remote SSH function, which enables remote debugging of code and file access.

The method is very simple, and is summarized here.

Additional Notes

A solution to an Error, you can ignore this for now

There will be an error during remote debugging. Just modify the luanch.json file.



Change the Console according to the screenshot above.
Refer to github issue: https://github.com/microsoft/vscode/issues/73867
If you are too lazy to read the issue, just follow the instructions above.

text

Reference Links:

https://code.visualstudio.com/docs/remote/ssh

Prerequisites: The remote server has the SSH server function enabled. Ubuntu systems are basically equipped with it.

apt-get install openssh-server

The local computer needs to have SSH function [Windows 10 comes with it, other versions need to install SSH support and add the path]

step

Download the VScode Insider version [https://code.visualstudio.com/insiders/]. When installing, note that there is an option to add vscode to the path. It is recommended to check it and do not uncheck it.

After installation, add the Remote Development extension. Note that you only need to install this plug-in, and other dependent packages will be downloaded automatically.

Optional: If you are using ssh with password authentication, you need to set "remote.SSH.showLoginTerminal": true in the local VScode's setting.json. For details, see [https://code.visualstudio.com/docs/remote/troubleshooting#_enabling-alternate-ssh-authentication-methods]. I personally recommend using ssh-keygen for authentication. It is really troublesome to keep entering passwords. The specific reasons will be explained later. Please search Baidu for how to generate and use ssh-keygen. I referred to this link: https://kb.iu.edu/d/aews. It is recommended to first use the password method to fully understand the Remote-ssh function and then start to see how to use ssh-keygen.

Open the local vscode, press ctrl+shift+P and enter remote, use the Remote-ssh: connect to host option

For the first use, you need to configure the host file, select Configure SSH Hosts

Here I will directly select config under the user name for configuration, and fill in the IP address and user name of the remote computer. After saving, use the Remote-ssh: connect to host command again.


If you choose password verification, the option to enter a password will pop up in the integrated terminal of VScode

Then the remote information will start to load and you will need to enter the password multiple times. . . This is why ssh-keygen is recommended. . .

Finally, you can see the output like this, which means the connection is complete. The connection process is still very fast.

At this point, open foler opens files on the remote computer, in the ~/ path by default. You also have to enter the password multiple times when opening the folder. .

Now you can directly view and debug files on the remote computer. Note that debugging the corresponding language requires installing the corresponding vscode extension, and vscode itself will automatically prompt you to install the extension. It can be seen that remote ssh can directly call the conda virtual environment on the remote side, which is very convenient to use.

This is the end of this article about VScode Remote SSH for remote editing and debugging of code. For more related VScode Remote SSH content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to connect to and configure vscode remotely via Remote SSH
  • Use VSCode's Remote-SSH to connect to Linux for remote development
  • How to use the Remote-SSH plugin in VSCode
  • Configure VScode remote development ssh-remote under Win10 (password-free login)

<<:  How to convert mysql bin-log log files to sql files

>>:  MySQL practical skills: analysis of methods to compare whether two tables have different data

Recommend

Use crontab to run the script of executing jar program regularly in centOS6

1. Write a simple Java program public class tests...

Detailed steps for installing ros2 in docker

Table of contents Main topic 1. Install Docker on...

Solve the problem of HTML automatic formatting after saving in vscode

The version of vsCode has been updated in recent ...

Detailed tutorial on installing and configuring MySql5.7 on Ubuntu 20.04

Table of contents 1. Ubuntu source change 2. Inst...

How to implement the webpage anti-copying function (with cracking method)

By right-clicking the source file, the following c...

Share 8 very useful CSS development tools

CSS3 Patterns Gallery This CSS3 pattern library s...

WeChat applet implements user login module server construction

I chose node.js to build the server. Friends who ...

Summary of methods to prevent users from submitting forms repeatedly

Duplicate form submission is the most common and ...

Query the data of the day before the current time interval in MySQL

1. Background In actual projects, we will encount...

You may not know these things about Mysql auto-increment id

Introduction: When using MySQL to create a table,...

Use button trigger events to achieve background color flashing effect

To achieve the background color flashing effect, j...

Practical method of deleting files from Linux command line

rm Command The rm command is a command that most ...

Website design should pay attention to the sense of color hierarchy

Recently I have been saying that design needs to h...