sftp sync extension for VS Code
Very simple and intuitive and works.
Features
- multiple configs
- dual authentication
- sync directory to remote
- sync directory to local
- download file/directory to local
- upload file/directory to remote
- upload to remote on save
- watch project directory for external changes and automatically update remote
- multiple file format support(file, directory, symbolic link)
Usage
Ctrl+Shift+P
on Windows/Linux open command palette, run SFTP: config
command.- Run command on editor context menu or explorer context menu.
Note1 :A command must run with a target(file or directory). When Running command within command palette it will ask you to select a folder.
Note2 :Sync commands will only be available to a directory. Try not to bind shortcuts to those commands because there is no way to figure out the target directory.
Commands
Command | Description | Detailed description |
---|
SFTP: Config | create a new config file at workspace root | see below for an explained config file |
SFTP: Upload | upload file/directory | copies selected files from the local to the remote directory, overwriting the remote ones. Files that are only present on the remote side won't be affected. Files that are only present on the local side will be created remotely |
SFTP: Download | download file/directory | same as above, but in the opposite direction |
SFTP: Sync To Remote | sync local directory to remote | only available for directories. Copies common files (that exist on both sides) from local dir to remote, overwriting destination. If syncMode is set to full, files that exist only on the local side will be created remotely, and files that exist only on the remote side will be deleted |
SFTP: Sync To Local | sync remote directory to local | same as above, but in the opposite direction |
Config
Example
{
"host": "host",
"username": "username",
"password": "password",
"remotePath": "/remote/workspace",
}
You can also use an array of configs in the config file.
[
{
"context": "/workspace/a",
"host": "host",
"username": "username",
"password": "password",
"remotePath": "/remote/workspace/a",
},
{
"context": "/workspace/b",
"host": "host",
"username": "username",
"password": "password",
"remotePath": "/remote/workspace/b",
}
]
Full Config
{
context: '.',
host: "host",
port: 22,
username: "username",
password: "password",
protocol: "sftp",
agent: null,
privateKeyPath: null,
passphrase: null,
passive: false,
interactiveAuth: true,
remotePath: "/",
uploadOnSave: false,
syncMode: 'update',
ignore: [
"**/.vscode/**",
"**/.git/**",
"**/.DS_Store"
],
watcher: {
files: false,
autoUpload: true,
autoDelete: true
}
}
Known Issues
Issue
ENFILE: file table overflow ...
Solution
MacOS has a harsh limit on the number of open files. Run these commands:
echo kern.maxfiles=65536 | sudo tee -a /etc/sysctl.conf
echo kern.maxfilesperproc=65536 | sudo tee -a /etc/sysctl.conf
sudo sysctl -w kern.maxfiles=65536
sudo sysctl -w kern.maxfilesperproc=65536
ulimit -n 65536