Skip to content

Instantly share code, notes, and snippets.

@radleta
Last active August 9, 2023 15:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save radleta/0b337a2b14f761951cf2aab0578512b9 to your computer and use it in GitHub Desktop.
Save radleta/0b337a2b14f761951cf2aab0578512b9 to your computer and use it in GitHub Desktop.
Step-by-step how to use rsync with git bash from Windows command prompt

Note: This works all except for the shell script part. Need to figure that out. You can do it interactively just not from the command prompt.

  1. Install Git
  2. Install Git Bash via Git Tortoise install
  3. Added HOME=/c/Users/$USERNAME to C:\Program Files\Git\etc\profile
  4. See https://stackoverflow.com/questions/32232978/change-the-location-of-the-directory-in-a-windows-install-of-git-bash
  5. Download rsync.exe from https://repo.msys2.org/msys/x86_64/rsync-3.2.3-2-x86_64.pkg.tar.zst use 7-zip to decompress
  6. See https://blog.tiger-workshop.com/add-rsync-to-git-bash-for-windows/
  7. Put rsync.exe into C:\Program Files\Git\usr\bin
  8. Open Git Bash and create a key file using ssh-keygen
  9. Create a shell script that copies the files
  10. Example test.sh
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
rsync -avz Pictures/ root@targetmachine:/data/pictures/
  1. Run the shell script from the command line
    1. "c:\Program Files\git\bin\sh.exe" -c "sh test.sh"
@lalthomas
Copy link

@2raghu
Copy link

2raghu commented Dec 30, 2021

@lalthomas Change tar.xz to tar.zst

@radleta
Copy link
Author

radleta commented Feb 27, 2022

Updated link. Untested.

@naXa777
Copy link

naXa777 commented Jan 19, 2023

there's a newer version of rsync available. go to https://repo.msys2.org/msys/x86_64/ and search for "rsync".
The current version is

rsync-3.2.7-2-x86_64.pkg.tar.zst 22-Dec-2022 09:53 365K

@JulioAviles
Copy link

$ rsync --version
C:/Program Files/Git/usr/bin/rsync.exe: error while loading shared libraries: msys-crypto-3.dll: cannot open shared object file: No such file or directory

I can not find msys-crypto-3.dll on https://packages.msys2.org/ and all internet

any comment !!

@bryangruneberg
Copy link

@JulioAviles - you'll find the dlls in the OpenSSL package: https://repo.msys2.org/msys/x86_64/libopenssl-3.0.8-1-x86_64.pkg.tar.zst

copying the two DLLs into the same folder as the rsync.exe got rsync working for me

@JulioAviles
Copy link

@JulioAviles - you'll find the dlls in the OpenSSL package: https://repo.msys2.org/msys/x86_64/libopenssl-3.0.8-1-x86_64.pkg.tar.zst

copying the two DLLs into the same folder as the rsync.exe got rsync working for me

You were right @bryangruneberg, I really appreciate your help, just hoping to be claner (I hope so) I put both file insize C:\ProgramFile\Git\bin folder and the magic happened, rsync working fine!! Thank's again.

HAPPY FIXING !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment