Git: Feature Request: add rsync as tool

Created on 2 Sep 2015  路  20Comments  路  Source: git-for-windows/git

There was already a discussion on msysgit, to add rsync to the set of preinstalled tools. But sadly it never made it.

Why I suggest to add rsync:
I personaly think it is the better way to deploy my projects to production with rsync and not with git,
because it's more easy to exclude /.git and other unwanted items. You all have heard of public /.git folders in production environments with sensitve data. Whoever would ever have done this?
So I would recommend to spread more the way to deploy with rsync.

And of course if you have rsync already running on your windows machine you can use it for a lot more cool things.

And guys come on, the size of rsync is not that heavy...

up for grabs

Most helpful comment

Just thought I'd post here for others searching to let people know that at least 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 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 (as listed in the ssh-pageant usage section) is add a small bit to your ~/.bashrc or ~/.bash_profile file. I've modified it specifically for use with the Git for Windows environment:

# 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.

All 20 comments

@C-Wx if you really want it, can I see the well-crafted Pull Request?

If my skills would allow it to start with that feature myself, I wouldn't have come up with this question to you guys. So this was just input from an user to you guys to consider my suggestion.

I'm sorry for not being able to contribute more than this.

It's not exactly hard. See for yourself what others did: https://github.com/git-for-windows/build-extra/pull/57 (The only other resource you need is here: https://github.com/git-for-windows/git/wiki/Making-an-installer).

My life would also be made a lot easier if rsync was included.

I think the best reason is just that git-fetch can use rsync. So, as ssh is included to handle ssh:// repos, it makes sense to include rsync for rsync:// repos

My personal reason is that git-annex uses rsync somewhat more heavily than git itself does, and git-annex for windows has a bear of a time including rsync and making it work with the ssh provided by git for windows.

The rsync:// protocol was deprecated a real long time ago.

As to including rsync, my suggestion stands.

Hey There!
I would also really wan't rsync included in git for windows, cause that really fixes working with symlinks in vagrant box on Windows.
Are there any other resources for compiling rsync with git SDK?

@vteivans sure: https://github.com/git-for-windows/MSYS2-packages/tree/master/rsync and https://github.com/git-for-windows/git/wiki/Package-management (in particular, https://github.com/git-for-windows/git/wiki/Package-management#rebuild-packages).

(But I fear that you will be disappointed in hearing that rsync cannot fix whatever problems you have with symlinks)

@dscho, no I already fixed everything with Rsync, and it works like a charm, the only problem is setting it up, so it would be great if it would be included in git for windows. :)

@vteivans The Git for Windows project is about empowering users to bring about what they want, without the need to rely on other people.

So if you are dreaming of a Git for Windows that ships rsync.exe, you can continue dreaming while preparing a Pull Request that imitates https://github.com/git-for-windows/build-extra/commit/920c19bd0381a89735326eab2490fd27e1ca4951, including a verbose commit message that describes that Git has not been relying on rsync for eons but that it is still nice to have and that it only adds <number> kilobytes to the installer.

I recently updated git from the git-scm site, and I have rsync now. So, was it included and this thread can be closed?

@geneorama It was not included:

$ which rsync
which: no rsync in ([the entire PATH])

(this is with Git for Windows 2.7.4's Git Bash)

Even worse, Git's support for the rsync protocol will be officially dropped with 2.8.0.

If there had been more action and less talking in this here ticket, I would actually have accepted a Pull Request to add rsync.exe to the official Git for Windows installer, but nothing happened at all, except for upstream removing rsync support officially. So now I am much less inclined to include a tool that turns out to be totally useless within Git's context.

Seriously, if you want to be able to install Unixy tools in your environment on Windows, Git for Windows (whose mission it is to bring _Git_ to the Windows masses) is a suboptimal choice. You definitely want to go with MSYS2 or Cygwin instead.

And this ticket is already closed ;-)

@dscho Your comment helped me considerably. I realized that my version of rsync is indeed not from git for windows. I hadn't run which rsync. Yes, insert forehead slap, eye rolling, and other nonverbal chiding here.
My version is from Rtools. The weird thing is that before updating git for windows the other day I simply got "rsync not found". I thought that updating _git for windows_ installed rsync. Actually, I must have had an error in my PATH variable, and after updating _git for windows_ I happened to adjust my PATH. It was this coincidental adjustment that made rsync available.

Just thought I'd post here for others searching to let people know that at least 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 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 (as listed in the ssh-pageant usage section) is add a small bit to your ~/.bashrc or ~/.bash_profile file. I've modified it specifically for use with the Git for Windows environment:

# 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.

@dlong500 Pagent configuration is actually documented in the Git for Windows wiki here.

@landstander668 Thanks for the link to the GfW specific ssh-pageant configuration info. I'll review that and may update my post with a better ssh-pageant command (though my original appears to work just fine, albeit with more hard-coded paths).

@landstander668 I've updated my above post with more robust ssh-pageant usage based on the info. However, I've actually enhanced it some further because the commands on the wiki don't account for a SSH_AUTH_SOCK environment variable that is defined but points to a file that doesn't exist anymore (as happens to be the case on my machine and I suspect quite a few others as well).

i would love to see this ticket reopend. of course rsync is not required for git but git for windows really makes windows rock. together with http://cmder.net/ (which also bundles with git for windows) it unixify the windows environment.

why i would prefer to have rsync directly in git for windows is because of the incompatibilities between ssh and rsync from different provider, see https://github.com/git-for-windows/git/issues/1401

having this in here allows us to use rsync which is updated regulary and perfectly work together with all the other shiped binaries.

i would love to see this ticket reopend.

I have a much better idea: work on it. Use https://github.com/git-for-windows/build-extra/commit/16d8d828be9c0e5bc8b180c941388cf114e742fb as an example, including the information in the commit message.

That idea is much better because:

  1. you have a much better chance of getting what you want, and
  2. you avoid dumping even more work on the already overwhelmed Git for Windows maintainer.

Use git-for-windows/build-extra@16d8d82 as an example

You could follow the link to the PR in this page, and then to the ticket linked from the PR, to get to the instructions I wrote how to get started with adding stuff to the installer. But I'll make it easy for you (having followed that trail already): https://github.com/git-for-windows/git/issues/1224#issuecomment-313948801

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Snaptags picture Snaptags  路  4Comments

vocaviking picture vocaviking  路  5Comments

Unknow0059 picture Unknow0059  路  3Comments

michaelblyons picture michaelblyons  路  5Comments

dscho picture dscho  路  3Comments