Fsync — Remote Sync Extension (SFTP & Rsync)
简体中文 | English
Introduction
Fsync is a remote file sync extension for individual developers, built on SFTP and Rsync. It keeps local and remote files in sync with save-triggered uploads, one-click full sync, a remote file explorer, and multi-server profile switching.
Features
- Save-Upload: Automatically uploads the saved file to the remote server via SFTP.
- Rsync Full Sync: One-click full rsync sync with automatic SFTP fallback.
- Remote Explorer: Browse, create, rename, and delete remote files.
- Multi-Profile: Switch between dev, staging, prod and other server profiles.
- File Watch: Watches local file changes and syncs automatically.
- Status Bar: Connection state and sync progress shown in the status bar.
Usage
Getting Started
- Run
Fsync: Init Config to generate .vscode/fsync.json in the workspace.
- Fill in your server profile (see Configuration below).
- Click the status bar or run
Fsync: Connect to connect.
Manual Upload
Fsync: Upload File / Fsync: Upload Folder: right-click in the Explorer to upload the selected files or folders (multi-select supported) to their mapped remote paths.
- From the command palette both commands prompt for paths instead of uploading immediately: entries are resolved against
localRoot, separated by , or spaces (use , when a path contains spaces). Invalid entries abort the batch with the reason (not found, outside the local root).
- In the Remote Explorer, right-click a remote directory and pick Upload to here... to upload local files into it.
Other Commands
Fsync: Download File, Fsync: Sync All, Fsync: Watch, Fsync: Switch Profile, Fsync: Show Output, etc.
Configuration
Project Config File
The workspace config file is .vscode/fsync.json (path configurable via fsync.configPath). See docs/modules/config.md for every field, its default and its exact semantics. Core structure:
{
"activeProfile": "dev",
"localRoot": ".",
"profiles": {
"dev": {
"host": "your-server.com",
"port": 22,
"username": "root",
"privateKeyPath": "~/.ssh/id_rsa",
"remoteRoot": "/var/www/project",
"syncMode": "auto",
"uploadOnSave": false,
"ignore": ["node_modules", "dist", ".git"],
"rsync": { "args": ["-avz"] }
}
}
}
Key points:
- Env var references work only as a whole value, e.g.
"password": "${SSH_PASSWORD}"; "${HOME}/.ssh/id_rsa" is passed through literally.
privateKeyPath accepts a leading ~ and takes precedence over password.
uploadOnSave defaults to false; set it to true per profile to upload on every save.
ignore defaults to [".git", ".vscode"]; add node_modules, build output, etc. yourself.
rsync.args never forwards --delete style flags, so uploads cannot remove remote files.
- If the config contains credentials, add it to
.gitignore.
VSCode Settings
| Setting |
Default |
Description |
fsync.configPath |
.vscode/fsync.json |
Config file path relative to the workspace root |
fsync.defaultSyncMode |
auto |
Fallback sync mode when a profile omits syncMode (sftp / rsync / auto) |
fsync.confirmDelete |
true |
Confirm before deleting remote files |
fsync.showProgress |
true |
Show transfer progress |
fsync.logLevel |
info |
Log level for the Output panel (debug / info / warn / error) |
Requirements
SFTP transfers are handled in-process (no external tools). Rsync sync additionally needs a working rsync binary and an OpenSSH ssh client on PATH:
- macOS: ships with rsync;
brew install rsync for a current version
- Linux:
sudo apt install rsync (Debian/Ubuntu) or sudo dnf install rsync (Fedora)
- Windows: install rsync for Windows (e.g. cwRsync or MSYS2) and make sure
rsync.exe and ssh are on PATH; rsync installed only inside WSL is not visible to VS Code
With syncMode: "auto" a missing rsync falls back to SFTP automatically (with a single warning per session); with syncMode: "rsync" or the Rsync Upload command the sync fails with an install hint instead of falling back.
Output Panel
All operations log to the Fsync output panel (View → Output → Fsync): connection events, transfer progress, rsync commands and statistics. Actively triggered transfers reveal the panel; save-triggered uploads do not. Use Fsync: Show Output to open it anytime.
Acknowledgments
This extension is inspired by and built upon the following projects: