As of now (9/7/2017) it is extremely easyMy original instructions to manually addget rsync support to theworking with Git for Windows environment without even havingwere quite a bit outdated, so I've revamped this answer for mid-2023 to resortcover MSYS2's switch to runningzstd and the Gitadditional dependencies required for Windows SDKrsync.
The primary issue is that MSYS2 now compresses most packages (including zstd, rsync, and dependencies) using zstd, but zstd isn't included in the base environment. Because of this we can't get zstd from the MSYS2 repository--but we can get it directly from the zstd Github releases where it is a zip archive rather than zst. The basic idea for getting rsync working that I stumbledoriginally came across in this post and didn't think it could really be that easy given allis still the alternativessame, but due to the above mentioned issues it really isrequires a bit more work. All you need to do The whole process is grab the rsync package from the MSYS2 Package repository and extractstill easily doable once we know everything required.
Below are commands to:
- download the zstd binary to use in extracting further packages
- download, extract, and place the rsync binary and it's dependencies in the correct bin folder
These steps have been tested on a clean install of Windows 11 with only the rsync.exe file intolatest Git for Windows installed C:\Program Files\Git\usr\bin. One and done(should work for Windows 10 as well). It works No other dependencies should be required to complete the steps.
As always, examine what you paste into a terminal and use at your own risk
Step 1: zstd requirement
If you need helphave an environment that doesn't already support extracting archives compressed with zstd rsync.exe(such as with Git for Windows), the easiest way is probably to download the latest zstd Windows binary directly from the rsync packageztsd release page: (which ishttps://github.com/facebook/zstd/releases. If you already have zstd available and in your sourced path then skip to step 2 tar.xz format),(and you can either use a compression utility like 7zip or do it directly withinmay need to adjust the zstd binary location in the script).
Copy the below lines into a Git Bash terminal after adjusting below variables for Windows bash environment like solatest source locations, versions, and your preferred download location:
cdworking="/c/temp-downloads" zstd_url="https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-v1.5.5-win64.zip" mkdir -p "$working" curl -L -o "$working/zstd.zip" "$zstd_url" unzip -j "$working/zstd.zip" "*/zstd.exe" -d "$working" Step 2: Downloading compatible rsync and dependency binaries, extracting, and placing in proper location
Copy the below lines into an admin Git Bash terminal after adjusting below variables for latest source locations, versions, and your preferred download location. The terminal must be running as admin if the destination bin folder is in a location requiring privileged access.
# If you downloaded zstd above, make sure your working folder is the same as where the zstd binary is located working="/c/downloaded_locationtemp-downloads" # Set the location of the Git usr/bin folder (under normal installations we can simply use /usr/bin because the MSYS2 root is the Git installation folder) git_usr_bin_folder_location="/usr/bin" rsync_url="https://repo.msys2.org/msys/x86_64/rsync-3.2.7-2-x86_64.pkg.tar.zst" libxxhash_url="https://repo.msys2.org/msys/x86_64/libxxhash-0.8.1-1-x86_64.pkg.tar.zst" mkdir -xvfp "$working" curl -L -o "$working/rsync.pkgtar.zst" "$rsync_url" curl -L -o "$working/libxxhash.tar.xzzst" usr"$libxxhash_url" tar -I "$working/binzstd.exe" -xvf "$working/rsync.exetar.zst" --stripdirectory="$working" tar -components=2I "$working/zstd.exe" -xvf "$working/libxxhash.tar.zst" --directory="$working" cp -a "$working/usr/bin/." "$git_usr_bin_folder_location" This givesThat should be all you the rsync.exe fileneed to get rsync working as everything else necessary should already be included in the downloaded location (adjust the package name accordingly). In light ofbase Git for Windows permissions issues I won't try to give specific commands on gettingMSYS2 environment. You can now clean up the exe intocontents of the C:\Program Files\Git\usr\binworking folder. You can copyHopefully at some point zstd will be included in the base environment and the extra step of acquiring it via an explorer GUI or via an elevated command line utility (and yeswon't be needed, but it will require admin level permissions to copy something into the Program Files folders)is what it is for now.
I can't speak to how other utilities might or might not work by manually installing them this way, but rsync appears to work just fine. Hopefully that repo will stay and continue to be updated--I'd think so because it's hosted at the official MSYS2 site.