Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add rsync to git bash for windows
@jolastar

This comment has been minimized.

Copy link

@jolastar jolastar commented Sep 24, 2018

For me the location which worked was C:\Program Files\Git\usr\bin i.e. more generally %ProgramFiles%\Git\usr\bin as mentioned here and here for example.

@oakgary

This comment has been minimized.

Copy link

@oakgary oakgary commented Jun 23, 2019

still working
thanks for sharing

@SherylHohman

This comment has been minimized.

Copy link

@SherylHohman SherylHohman commented Jul 23, 2019

I cannot unpack the .xz file in Git Bash for Windows:
$ tar -xf rsync-3.1.3-1-x86_64.pkg.tar.xz

tar: .PKGINFO: Cannot open: Permission denied
tar: .BUILDINFO: Cannot open: Permission denied
tar: .MTREE: Cannot open: Permission denied
tar: usr: Cannot mkdir: Permission denied
tar: usr: Cannot mkdir: Permission denied
tar: usr/bin: Cannot mkdir: No such file or directory
tar: usr: Cannot mkdir: Permission denied
tar: usr/lib: Cannot mkdir: No such file or directory
tar: usr: Cannot mkdir: Permission denied
tar: usr/share: Cannot mkdir: No such file or directory
tar: usr: Cannot mkdir: Permission denied
tar: usr/share/man: Cannot mkdir: No such file or directory
tar: usr: Cannot mkdir: Permission denied
tar: usr/share/man/man1: Cannot mkdir: No such file or directory
tar: usr: Cannot mkdir: Permission denied
tar: usr/share/man/man5: Cannot mkdir: No such file or directory
tar: usr: Cannot mkdir: Permission denied
tar: usr/share/man/man5/rsyncd.conf.5.gz: Cannot open: No such file or directory
tar: usr: Cannot mkdir: Permission denied
tar: usr/share/man/man1/rsync.1.gz: Cannot open: No such file or directory
tar: usr: Cannot mkdir: Permission denied
tar: usr/lib/rsync: Cannot mkdir: No such file or directory
tar: usr: Cannot mkdir: Permission denied
tar: usr/lib/rsync/rrsync: Cannot open: No such file or directory
tar: usr: Cannot mkdir: Permission denied
tar: usr/bin/rsync.exe: Cannot open: No such file or directory
tar: Exiting with failure status due to previous errors

sh bin $ sudo tar -xf rsync-3.1.3-1-x86_64.pkg.tar.xz

bash: sudo: command not found

Any suggestions?

@hisplan

This comment has been minimized.

Copy link
Owner Author

@hisplan hisplan commented Jul 24, 2019

I don't have a WIndows machine with me right now, but since the error you're getting is a permission issue, you might want to try extracting the tar file in the directory where you have a full permission (e.g. Downloads) then move the executable to where git is installed.

@SherylHohman

This comment has been minimized.

Copy link

@SherylHohman SherylHohman commented Jul 26, 2019

@hisplan That worked! Thank You :-)

@MoonLightElf

This comment has been minimized.

Copy link

@MoonLightElf MoonLightElf commented Jan 17, 2020

I recommend this question and answer. Then install fish via PacMan in msys2.
https://stackoverflow.com/questions/32712133/package-management-in-git-for-windows/60611888#60611888

#how to execute rsync

 chmod +x /usr/bin/rsync.exe
/usr/bin/rsync.exe <source_folder> <target_folder>
@aisteron

This comment has been minimized.

Copy link

@aisteron aisteron commented Mar 5, 2020

rsync
rename 76008178-1fbb4d80-5f07-11ea-9c47-31d8e84f5dd0.jpg -> rsync.exe

@rshad

This comment has been minimized.

Copy link

@rshad rshad commented Apr 26, 2020

You saved my day. Thank you!

@LwServices

This comment has been minimized.

Copy link

@LwServices LwServices commented May 3, 2020

for me worked C:\Program Files\Git\cmd\

@mattirish

This comment has been minimized.

Copy link

@mattirish mattirish commented May 18, 2020

Worked great using @jolastar's comment for the installation directory. Thanks, every1!

For me the location which worked was C:\Program Files\Git\usr\bin i.e. more generally %ProgramFiles%\Git\usr\bin as mentioned here and here for example.

@charlie-cadmv

This comment has been minimized.

Copy link

@charlie-cadmv charlie-cadmv commented Sep 21, 2020

Git Bash's root directory maps to the root of your Git SCM installation which may be in %programFiles% or it may not.
You can run cygpath -w / to get Git Bash to tell you where it's running from.
Even if you're running PortableGit like I am, it will print out the Windows equivalent path of Git's root, which is the directory where you should be extracting the .tar.xz file using the tar -xf command.
But why bother with the Windows path at all?
You can do everything from within Git Bash!

#Make a temporary directory
tempDir=$(mktemp -d)
#go into that dir
pushd "$tempDir"
#download the file using its original name
curl -O http://www2.futureware.at/~nickoe/msys2-mirror/msys/x86_64/rsync-3.1.2-2-x86_64.pkg.tar.xz
#cd to Git Bash root directory (which is your Git directory, so you don't need to look it up or assume it's in %programfiles%)
cd /
#extract the files to their proper places (all of them, not just rsync.exe)
tar -xf "${tempDir}/rsync-3.1.2-2-x86_64.pkg.tar.xz"
#get back to your original directory
popd
#clean up that temp directory and the downloaded .tar.xz file
rm -rf "$tempDir"
#see that rsync is in the path now
which rsync

@ahmednrana

This comment has been minimized.

Copy link

@ahmednrana ahmednrana commented Oct 16, 2020

Life saver

@llraj

This comment has been minimized.

Copy link

@llraj llraj commented Oct 21, 2020

@hisplan Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.