sftp configuration
1. Download the sftp plugin in vscode
- In vscode, use the shortcut key to
ctrl+shift+P
open the command window, enterextension:install
, press Enter, and the extension installation interface will be opened on the left. - Enter in the search box
sftp
, the first one is what needs to be installed, click Install
2. Configure sftp.json in the vscode project
-
Then the shortcut key
ctrl+shift+P
opens the command window, input , press Enter, and a file will be generated in the folder ofsftp:config
the current working project . What we need to configure is: these contents are enough:.vscode
sftp.json
host, username, privateKeyPath, remotePath, ignore
- host: IP address of the workstation
- username: the workstation's own username
- privateKeyPath: The locally configured key file for logging in to the workstation. Choose one of the following passwords (it can be in openssh format or ppk format)
- password: The workstation's own user password. Use the key and use the password to choose one; if the password is used, the workstation does not need to configure ssh, but if the key is used, the workstation needs to be configured with ssh, and the password can be filled with null
- remotePath: The folder path on the workstation that is synchronized with the local project. It needs to have the same name as the root directory of the local project file. Before using sftp to upload files, you need to manually
mkdir
generate this root directory on the workstation. Other subdirectories under the root directory will automatically correspond to generate - ignore: Specify
sftp: sync to remote
the files and folders to ignore when using, note that there is a comma after each line, and there is no comma in the last line
-
Here is an example:
-
After the configuration is complete, you can
sftp
directly upload and download any file in the corresponding project file with the instructions used in vscode (right-click on the file or folder in the file directory on the left, optional in the menu), and you can also configure your own shortcut keys