Learn VScode [2] VSCODE + SFTP Plug -IN Real -Time Synchronization Code for the remote server

1. VSCODE + SFTP Plug – Real time synchronization of code with remote server

1.1 VSCODE Install the SFTP plug-in

1.2 Create an SFTP configuration

1) Principle
  • First of all, there must be a project folder in the local area, as well as a project folder in the remote area. Then, through configuration, the contents of these two files can be synchronized.
  • SFTP can display all files of a remote project, but it does not work directly. You have to work with local project files and then synchronize with remote projects
2) Composition

There is a ‘sftpfolder’ folder in the local and one remote. Use VSCODE to open the local folder “SftPFolder” (automatically capitalized) and then executectrl+shift+p Quick key to configure the command parameters panel, searchSFTP:Config When returning, it will generate “.vscode/sftp.json”, which is a configuration file. At the same time, on the left side of the figure below, there will be a “remote directory”.

3) General configuration (remember that there is no comment content)
{
    "name": "Имя локальной папки (настраиваемое)",
    "host": "IP или доменное имя",
    "protocol": «Соглашение: [SFTP/FTP] по умолчанию FTP»,
    "port": 22,
    "username": "username",
    "password":"password",
    "passphrase": "null", 
    "passive": false, 
    "interactiveAuth": true,
    "remotePath": "Удаленный адрес папки, по умолчанию/",
    "context": "Локальный адрес папки, по умолчанию,
    "uploadOnSave": true,
    "downloadOnOpen":false,
    "syncMode": "update",
    "ignore": [
        "**/.vscode/**",
        "**/.git/**",
        "**/.DS_Store"
    ],
    "watcher": {
        "files": "*",
        "autoUpload": false,
        "autoDelete": false
    }
}

The configuration file cannot be written to, so many attributes are displayed here

  • UploardOnsave: Save the updated local file automatically syncs with remote files (file renaming and deleting files will not be synced),After saving the mod file, it will be automatically uploaded to the server. If not required, change the configuration file to false
  • DownloadOnoPen: Download an open file from a remote server
  • Ignore: Files and folders are ignored when using SFTP: Sync with Remote. Note that there is a comma after each line and no comma on the last line
  • Ignore: Ignored files (corresponding files will not be synced)
  • observer: listener (can rename files and delete files),It is not recommended to enable auto-upload and avoid temporary changes on the server to be automatically changed
    • Auto-upload: file changes are automatically synced (modify, rename)
    • Auto Delete: File deletion will be synchronized automatically

Understanding

  • Privatekeypath: The keyfiles are allocated for logging into the workstation locally. Choose one with the following password (which may work in OpenSsh, or may be in PPK format)
  • Password: The password for the workstation user. Use key and password to choose.
  • “Agent”: “null” and “privatekeypath”: “The file path on this machine” should not be used together
4) Use SFTP

Uplotoonsave opens set to True After saving the local file, it will sync to the server without any manual work. (Any files that don’t synchronize the name will sync files that have been deleted locally)

The upload folder and the upload folder are used when both uploadonsov and monitors are used

  • Synchronize all engineering files Right click on the folder you want to sync: Select SFTP: SYNC with Remote Return

  • Single file sync Right-click the file you want to sync, select SFTP:Upload, you can sync with a remote server, or use the keyboard shortcut CTRL+Shift+P to shuffle the input field, select SFTP:UP:UP:click:UP:UP :UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP: UP :UP: UP: UP: UP: UP: UP: UP: UP: Load Device Input

    Link 1: https://blog.csdn.net/iamlujingtao/article/details/102501845
    Link 2: https://blog.csdn.net/sunny327/article/details/818667855

Leave a Comment