Vscode remotely connects to the server + uploads and uploads files

VSCode remote server recording



foreword

Make sure that the remote ssh and sftp plug-ins are installed in the local vscode (the installation will not be introduced here)

1. Connect to a remote server?

1. Click Remote Explorer
insert image description here

2. Click the small tool icon and the box on the right will appear, select the first...\config
insert image description here

3. This file is the configuration file. After filling in and saving the file, press the refresh button on the left and the instance of the server will appear (you can fill in the configuration information of multiple servers in the config, and the corresponding one will be displayed in the status bar on the right. number)

Host: 远程服务器的地址
HostName:远程服务器的地址
User:远程登录的用户名
Port:端口号

insert image description here

4. Right-click on the corresponding server on the left, and you will choose to display the server in the current window or open a new window (it is recommended to open a new window) 5. Then it will display
insert image description here
at the top that you need to enter a password
insert image description here

6. It is displayed in the lower left corner like this, even if it is connected
insert image description here

2. Upload files to the server

1. After the installation is complete, locally! ! Shortcut key ctrl+shift+P, search for sftp, click SFTP.config
insert image description here
2. Edit the configuration file (create a remote workspace)

	"name": 随便起个名字,
    "host": 远程地址,
    "protocol": "sftp",
    "port": 端口号,
    "username": 远程用户,
    "remotePath": 远程工作区的路径(必须在远程服务器中存在),
    "uploadOnSave": true

Save after editing
insert image description here
3. Locally transfer files to the server
Enter the local vscode window, right-click the file to be uploaded (root directory files cannot be uploaded), click Upload Folder to upload
... After clicking, you may be asked to enter a password again
insert image description here

The corresponding location on the server is uploaded successfully
insert image description here


3. Download the file from the server to the local

Select the file to download and right click to download/download
insert image description here

4. Delete useless remote servers

In the local remote resource manager, click the tool icon to enter the original config file

Delete the unused server configuration in the file, and then save the file. go back and refresh
insert image description here
insert image description here


reference:

https://blog.csdn.net/xsh_roy/article/details/127402400

Guess you like

Origin blog.csdn.net/qq_43545501/article/details/127930468