This article is converted by SimpRead, original address kaifeiji.cc
This blog is deployed on a VPS, previously always uploaded to the server using SFTP, which was not very convenient. Thought of using rsync for remote synchronization.
This blog is deployed on a VPS, previously always uploaded to the server using SFTP, which was not very convenient.
Thought of using rsync for remote synchronization.
Options for remote file sync
There are quite a few options for remotely syncing files to a Linux server:
- SFTP
Linux distributions generally come with sftp-server, so you only need to install FileZilla locally and connect using an SSH account to upload.
There are three pain points: first, it’s difficult to automate with scripts; second, encrypted transmission is slow; third, updating synchronization is not convenient (full overwrite? selective overwrite?).
- FTP
Linux requires installing an FTP server, which is not complicated; still use FileZilla locally.
Solves the slow speed problem of SFTP, but still cannot achieve automated update synchronization.
- Git
Needs a Git server as a relay, GitHub, GitLab, Gitee, or a self-built Git Server all work.
Clone the same repository locally and on the VPS.
Local commit (git commit -m "new article"), push (git push).
VPS pulls (git pull).
Achieves incremental synchronization without full overwrite (hundreds of MB) taking forever.
- rsync
Comes with Linux, fast speed, incremental synchronization—simply perfect.
Using rsync on Windows
Here’s the key point, how to use the Linux rsync command on Windows?
cwrsync
cwrsync is an implementation of rsync on Windows developed by itefix.net.
There was a free version in the early days, now the official site charges and does not provide free download links, but it can still be downloaded elsewhere.
Download and extract to C:\\app\\cwrsync, enter cmd:
C:\\app\\cwrsync> cd bin
C:\\app\\cwrsync\\bin> rsync -av --progress /cygdrive/c/some/path/ user@123.123.123.123:/var/www/blog
Note: rsync does not support Windows-style paths (e.g., C:\some\path\). cwrsync uses /cygdrive/c/some/path/, which maps to the corresponding path on drive C.
cygwin
cygwin is a POSIX-compatible layer on Windows: provides Cygwin Terminal that can execute Shell commands such as ls, mkdir, etc.; it also provides a package management service that can install common Linux software, including rsync.
During the installation of cygwin, you can choose to install rsync:
If cygwin is already installed, you can run cygwin’s setup installer again to select rsync for installation.
After installation, just use rsync directly:
Exactly, cygwin paths are also /cygdrive/c/some/path/ because cwrsync is actually developed based on cygwin.
git bash
The advantage is that as long as git is installed on Windows, rsync can be used; the drawback is that installing rsync is relatively troublesome.
Refer to this expert’s article:
Unlike cygwin, git bash is a bash shell implemented on Windows based on MinGW, and it maps Windows paths like this: /c/some/path/.
WSL
WSL is a heavier solution but once set up, it works forever. Won’t elaborate further here.

