Sync
Synchronize files and directories between local and remote servers using SSH and rsync.
Sync
HostnExtra Sync is the official file synchronization plugin for the HostnExtra CLI.
It provides a simpler interface around rsync for synchronizing files and directories between your local machine and remote servers over SSH.
HostnExtra Sync keeps the transfer engine provided by rsync while simplifying common synchronization workflows.
Features
- Push files and directories to remote servers
- Pull files and directories from remote servers
- Compare local and remote content
- Watch directories and synchronize changes automatically
- Dry-run support
- File and directory exclusions
- Safe directory-scoped deletion
- SSH connection reuse
- Remote
rsyncavailability detection - Transfer progress reporting
- Direct SSH targets
- HostnExtra SSH Config integration
Quick Start
Install the plugin:
hostnextra plugin add syncPush a local directory to a remote server:
hostnextra sync push ./build --to web-prod-01:/var/wwwPull files from a remote server:
hostnextra sync pull web-prod-01:/var/www/build --to ./backupCompare local and remote content:
hostnextra sync diff ./build --to web-prod-01:/var/wwwWatch a local directory for changes:
hostnextra sync watch ./src --to web-prod-01:/var/wwwHow It Works
HostnExtra Sync provides the CLI interface while rsync performs the actual file synchronization.
SSH is used for remote connections and authentication.
This means HostnExtra Sync can take advantage of the synchronization and transfer capabilities provided by rsync while providing a simpler command structure.
Requirements
HostnExtra Sync requires:
- Node.js 22 or later
rsyncinstalled locallyrsyncinstalled on the remote server- SSH access to the remote server
Check your local rsync installation:
rsync --versionSSH Configuration
HostnExtra Sync supports direct SSH targets and can also integrate with the HostnExtra SSH Config plugin.
For example:
hostnextra sync push ./build --to web-prod-01:/var/wwwThe SSH Config plugin is optional. Direct SSH targets can be used independently.
Next Steps
- Learn how to install Sync
- Explore the available commands
- Learn about SSH targets
- Configure exclusions
- Understand the
--deleteoption