在Windows上利用git bash运行linux命令rsync
先下载好git for windows
https://gitforwindows.org
-
如果git bash运行不了zstd命令,先下好zstd(用来压缩和解压文件.zst)
https://github.com/facebook/zstd/releases/download/v1.4.4/zstd-v1.4.4-win64.zip
-
所有这些linux的可执行文件的包需要下载:
Index of /msys/x86_64/ (msys2.org) 或 https://mirror.msys2.org/msys/x86_64
-
解压
zstd -d rsync-3.2.3-1-x86_64.pkg.tar.zst tar -xvf rsync-3.2.3-1-x86_64.pkg.tar
-
将解压后的文件里的bin,lib,share里的内容对应挪至git安装文件夹(例如C:\Program Files\Git)里usr下对应的bin,lib,share里
mv ~/Downloads/rsync/usr/bin/rsync.exe C:\Program Files\Git\usr\bin
之后也可以把它手动添加到.bashrc里面,但是不添加后面也能用
echo "alias rsync=\"/usr/bin/rsync.exe\"" >> ~/.bashrc source ~/.bashrc
-
之后缺哪个包就用同样的方式下载哪个,注意如果少
msys-zstd-1.dll
就是要去下载libzstd,注意前面有个lib,如果少msys-crypto-3.dll
就下载libopenssl
Reference:
How to use rsync on Git Bash. Here’s a guide on how to use rsync on… | by Seunghyun Chae | Medium