Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
revamp answer to account for several changes over the past six years
Source Link

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.

As of now (9/7/2017) it is extremely easy to manually add rsync support to the Git for Windows environment without even having to resort to running the Git for Windows SDK.

  I stumbled across this post and didn't think it could really be that easy given all the alternatives, but it really is. All you need to do is grab the rsync package from the MSYS2 Package repository and extract the rsync.exe file into C:\Program Files\Git\usr\bin. One and done. It works.

If you need help extracting rsync.exe from the rsync package (which is in tar.xz format), you can either use a compression utility like 7zip or do it directly within the Git for Windows bash environment like so:

cd /c/downloaded_location tar -xvf rsync.pkg.tar.xz usr/bin/rsync.exe --strip-components=2 

This gives you the rsync.exe file in the downloaded location (adjust the package name accordingly). In light of Windows permissions issues I won't try to give specific commands on getting the exe into the C:\Program Files\Git\usr\bin folder. You can copy it via an explorer GUI or via an elevated command line utility (and yes, it will require admin level permissions to copy something into the Program Files folders).

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.

My original instructions to get rsync working with Git for Windows were quite a bit outdated, so I've revamped this answer for mid-2023 to cover MSYS2's switch to zstd and the additional dependencies required for rsync. 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 originally came across in this post is still the same, but due to the above mentioned issues it requires a bit more work. The whole process is still 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 latest Git for Windows installed (should work for Windows 10 as well). 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 have an environment that doesn't already support extracting archives compressed with zstd (such as with Git for Windows), the easiest way is probably to download the latest zstd Windows binary directly from the ztsd release page: https://github.com/facebook/zstd/releases. If you already have zstd available and in your sourced path then skip to step 2 (and you may need to adjust the zstd binary location in the script).

Copy the below lines into a Git Bash terminal after adjusting below variables for latest source locations, versions, and your preferred download location:

working="/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/temp-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 -p "$working" curl -L -o "$working/rsync.tar.zst" "$rsync_url" curl -L -o "$working/libxxhash.tar.zst" "$libxxhash_url" tar -I "$working/zstd.exe" -xvf "$working/rsync.tar.zst" --directory="$working" tar -I "$working/zstd.exe" -xvf "$working/libxxhash.tar.zst" --directory="$working" cp -a "$working/usr/bin/." "$git_usr_bin_folder_location" 

That should be all you need to get rsync working as everything else necessary should already be included in the base Git for Windows MSYS2 environment. You can now clean up the contents of the working folder. Hopefully at some point zstd will be included in the base environment and the extra step of acquiring it won't be needed, but it is what it is for now.

removed unnecessary destination option in tar command
Source Link

As of now (9/7/2017) it is extremely easy to manually add rsync support to the Git for Windows environment without even having to resort to running the Git for Windows SDK.

I stumbled across this post and didn't think it could really be that easy given all the alternatives, but it really is. All you need to do is grab the rsync package from the MSYS2 Package repository and extract the rsync.exe file into C:\Program Files\Git\usr\bin. One and done. It works.

If you need help extracting rsync.exe from the rsync package (which is in tar.xz format), you can either use a compression utility like 7zip or do it directly within the Git for Windows bash environment like so:

cd /c/downloaded_location tar -xvf rsync.pkg.tar.xz -C /c/downloaded_location/ usr/bin/rsync.exe --strip-components=2 

This gives you the rsync.exe file in the downloaded location (adjust the package name accordingly). In light of Windows permissions issues I won't try to give specific commands on getting the exe into the C:\Program Files\Git\usr\bin folder. You can copy it via an explorer GUI or via an elevated command line utility (and yes, it will require admin level permissions to copy something into the Program Files folders).

If you want to also use Pageant authentication with rsync over ssh, the ssh-pageant binary is already installed in Git for Windows and all you need to do is add a small bit to your ~/.bashrc or ~/.bash_profile file (see ssh-pageant usage section and Git for Windows wiki). I've modified it specifically for use with the Git for Windows environment and enhanced it with some detection for a missing socket file:

# ssh-pageant allows use of the PuTTY authentication agent (Pageant) SSH_PAGEANT="$(command -v ssh-pageant)" if [ -S "$SSH_AUTH_SOCK" ]; then PAGEANT_SOCK=$SSH_AUTH_SOCK else PAGEANT_SOCK=${TEMP:-/tmp}/.ssh-pageant-$USERNAME fi if [ -x "$SSH_PAGEANT" ]; then eval $("$SSH_PAGEANT" -qra "$PAGEANT_SOCK") fi unset SSH_PAGEANT unset PAGEANT_SOCK 

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.

As of now (9/7/2017) it is extremely easy to manually add rsync support to the Git for Windows environment without even having to resort to running the Git for Windows SDK.

I stumbled across this post and didn't think it could really be that easy given all the alternatives, but it really is. All you need to do is grab the rsync package from the MSYS2 Package repository and extract the rsync.exe file into C:\Program Files\Git\usr\bin. One and done. It works.

If you need help extracting rsync.exe from the rsync package (which is in tar.xz format), you can either use a compression utility like 7zip or do it directly within the Git for Windows bash environment like so:

cd /c/downloaded_location tar -xvf rsync.pkg.tar.xz -C /c/downloaded_location/ usr/bin/rsync.exe --strip-components=2 

This gives you the rsync.exe file in the downloaded location (adjust the package name accordingly). In light of Windows permissions issues I won't try to give specific commands on getting the exe into the C:\Program Files\Git\usr\bin folder. You can copy it via an explorer GUI or via an elevated command line utility (and yes, it will require admin level permissions to copy something into the Program Files folders).

If you want to also use Pageant authentication with rsync over ssh, the ssh-pageant binary is already installed in Git for Windows and all you need to do is add a small bit to your ~/.bashrc or ~/.bash_profile file (see ssh-pageant usage section and Git for Windows wiki). I've modified it specifically for use with the Git for Windows environment and enhanced it with some detection for a missing socket file:

# ssh-pageant allows use of the PuTTY authentication agent (Pageant) SSH_PAGEANT="$(command -v ssh-pageant)" if [ -S "$SSH_AUTH_SOCK" ]; then PAGEANT_SOCK=$SSH_AUTH_SOCK else PAGEANT_SOCK=${TEMP:-/tmp}/.ssh-pageant-$USERNAME fi if [ -x "$SSH_PAGEANT" ]; then eval $("$SSH_PAGEANT" -qra "$PAGEANT_SOCK") fi unset SSH_PAGEANT unset PAGEANT_SOCK 

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.

As of now (9/7/2017) it is extremely easy to manually add rsync support to the Git for Windows environment without even having to resort to running the Git for Windows SDK.

I stumbled across this post and didn't think it could really be that easy given all the alternatives, but it really is. All you need to do is grab the rsync package from the MSYS2 Package repository and extract the rsync.exe file into C:\Program Files\Git\usr\bin. One and done. It works.

If you need help extracting rsync.exe from the rsync package (which is in tar.xz format), you can either use a compression utility like 7zip or do it directly within the Git for Windows bash environment like so:

cd /c/downloaded_location tar -xvf rsync.pkg.tar.xz usr/bin/rsync.exe --strip-components=2 

This gives you the rsync.exe file in the downloaded location (adjust the package name accordingly). In light of Windows permissions issues I won't try to give specific commands on getting the exe into the C:\Program Files\Git\usr\bin folder. You can copy it via an explorer GUI or via an elevated command line utility (and yes, it will require admin level permissions to copy something into the Program Files folders).

If you want to also use Pageant authentication with rsync over ssh, the ssh-pageant binary is already installed in Git for Windows and all you need to do is add a small bit to your ~/.bashrc or ~/.bash_profile file (see ssh-pageant usage section and Git for Windows wiki). I've modified it specifically for use with the Git for Windows environment and enhanced it with some detection for a missing socket file:

# ssh-pageant allows use of the PuTTY authentication agent (Pageant) SSH_PAGEANT="$(command -v ssh-pageant)" if [ -S "$SSH_AUTH_SOCK" ]; then PAGEANT_SOCK=$SSH_AUTH_SOCK else PAGEANT_SOCK=${TEMP:-/tmp}/.ssh-pageant-$USERNAME fi if [ -x "$SSH_PAGEANT" ]; then eval $("$SSH_PAGEANT" -qra "$PAGEANT_SOCK") fi unset SSH_PAGEANT unset PAGEANT_SOCK 

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.

Added info about how to extract the file from within Git Bash.
Source Link

As of now (9/7/2017) it is extremely easy to manually add rsync support to the Git for Windows environment without even having to resort to running the Git for Windows SDK.

I stumbled across this post and didn't think it could really be that easy given all the alternatives, but it really is. All you need to do is grab the rsync package from the MSYS2 Package repository and extract the rsync.exe file into C:\Program Files\Git\usr\bin. One and done. It works.

AssumingIf you downloadedneed help extracting rsync.exe from the rsync package (which is in tar.xz file to your Downloads folderformat), you can unpackeither use a compression utility like 7zip or do it from withingdirectly within the Git Bash usingfor Windows bash environment like so:

cd /c/downloaded_location tar &&-xvf rsync.pkg.tar.xz Jxvf-C /c/Usersdownloaded_location/$USR usr/Downloadsbin/rsync-3.1.3exe -1-x86_64.pkg.tar.xzstrip-components=2 

This gives you the rsync.exe file in the downloaded location (adjust the package name accordingly). In light of Windows permissions issues I won't try to give specific commands on getting the exe into the C:\Program Files\Git\usr\bin folder. You can copy it via an explorer GUI or via an elevated command line utility (and yes, it will require admin level permissions to copy something into the Program Files folders).

If you want to also use Pageant authentication with rsync over ssh, the ssh-pageant binary is already installed in Git for Windows and all you need to do is add a small bit to your ~/.bashrc or ~/.bash_profile file (see ssh-pageant usage section and Git for Windows wiki). I've modified it specifically for use with the Git for Windows environment and enhanced it with some detection for a missing socket file:

# ssh-pageant allows use of the PuTTY authentication agent (Pageant) SSH_PAGEANT="$(command -v ssh-pageant)" if [ -S "$SSH_AUTH_SOCK" ]; then PAGEANT_SOCK=$SSH_AUTH_SOCK else PAGEANT_SOCK=${TEMP:-/tmp}/.ssh-pageant-$USERNAME fi if [ -x "$SSH_PAGEANT" ]; then eval $("$SSH_PAGEANT" -qra "$PAGEANT_SOCK") fi unset SSH_PAGEANT unset PAGEANT_SOCK 

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.

As of now (9/7/2017) it is extremely easy to manually add rsync support to the Git for Windows environment without even having to resort to running the Git for Windows SDK.

I stumbled across this post and didn't think it could really be that easy given all the alternatives, but it really is. All you need to do is grab the rsync package from the MSYS2 Package repository and extract the rsync.exe file into C:\Program Files\Git\usr\bin. One and done. It works.

Assuming you downloaded the tar.xz file to your Downloads folder, you can unpack it from withing Git Bash using:

cd / && tar Jxvf /c/Users/$USR/Downloads/rsync-3.1.3-1-x86_64.pkg.tar.xz 

If you want to also use Pageant authentication with rsync over ssh, the ssh-pageant binary is already installed in Git for Windows and all you need to do is add a small bit to your ~/.bashrc or ~/.bash_profile file (see ssh-pageant usage section and Git for Windows wiki). I've modified it specifically for use with the Git for Windows environment and enhanced it with some detection for a missing socket file:

# ssh-pageant allows use of the PuTTY authentication agent (Pageant) SSH_PAGEANT="$(command -v ssh-pageant)" if [ -S "$SSH_AUTH_SOCK" ]; then PAGEANT_SOCK=$SSH_AUTH_SOCK else PAGEANT_SOCK=${TEMP:-/tmp}/.ssh-pageant-$USERNAME fi if [ -x "$SSH_PAGEANT" ]; then eval $("$SSH_PAGEANT" -qra "$PAGEANT_SOCK") fi unset SSH_PAGEANT unset PAGEANT_SOCK 

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.

As of now (9/7/2017) it is extremely easy to manually add rsync support to the Git for Windows environment without even having to resort to running the Git for Windows SDK.

I stumbled across this post and didn't think it could really be that easy given all the alternatives, but it really is. All you need to do is grab the rsync package from the MSYS2 Package repository and extract the rsync.exe file into C:\Program Files\Git\usr\bin. One and done. It works.

If you need help extracting rsync.exe from the rsync package (which is in tar.xz format), you can either use a compression utility like 7zip or do it directly within the Git for Windows bash environment like so:

cd /c/downloaded_location tar -xvf rsync.pkg.tar.xz -C /c/downloaded_location/ usr/bin/rsync.exe --strip-components=2 

This gives you the rsync.exe file in the downloaded location (adjust the package name accordingly). In light of Windows permissions issues I won't try to give specific commands on getting the exe into the C:\Program Files\Git\usr\bin folder. You can copy it via an explorer GUI or via an elevated command line utility (and yes, it will require admin level permissions to copy something into the Program Files folders).

If you want to also use Pageant authentication with rsync over ssh, the ssh-pageant binary is already installed in Git for Windows and all you need to do is add a small bit to your ~/.bashrc or ~/.bash_profile file (see ssh-pageant usage section and Git for Windows wiki). I've modified it specifically for use with the Git for Windows environment and enhanced it with some detection for a missing socket file:

# ssh-pageant allows use of the PuTTY authentication agent (Pageant) SSH_PAGEANT="$(command -v ssh-pageant)" if [ -S "$SSH_AUTH_SOCK" ]; then PAGEANT_SOCK=$SSH_AUTH_SOCK else PAGEANT_SOCK=${TEMP:-/tmp}/.ssh-pageant-$USERNAME fi if [ -x "$SSH_PAGEANT" ]; then eval $("$SSH_PAGEANT" -qra "$PAGEANT_SOCK") fi unset SSH_PAGEANT unset PAGEANT_SOCK 

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.

Added info about how to extract the file from within Git Bash.
Source Link
Loading
updated ssh-pageant configuration
Source Link
Loading
Source Link
Loading