11

I use git bash on a windows machine: version 2.7.2 (32-bit version) of Git for Windows built on 2016-02-23 available from https://git-scm.com.

Within bash I can copy a directory from /c/ to /e/ (a USB thumb drive). However, I get errors when I try to use rsync. I tried adding cygdrive to the directory names, but that didn't work. Also tried adding -e (just to see what would happen) that didn't work either.

I mention that the copy command works because it's strange that I can see the drive one way, but not see it another way.

Successful copy:

enter image description here

Unsuccessful rsync:

enter image description here

Additional background and research:

Error 255

At some point I believe that I was getting the exact same error (255), which led me to this post. However, the solution here is related to cygwin, not git bash. https://stackoverflow.com/questions/16969119/dotcloud-push-on-cygwin-fails-with-rsync-error-unexplained-error-code-255

Vagrant and rsync

There is a lot of good disucssion about the mechanics of rsync, especially from mitchellh. However, I wasn't sure which components they reference are present in my installation, or sure how to tell. I asked a separate question on this site about that issue. source: https://github.com/mitchellh/vagrant/issues/3236

Listing drives in emulated Linux environments

source: http://mingw-users.1079350.n2.nabble.com/Windows-c-drive-td6555321.html When I do cat /etc/fstab I get the following:

$ cat /etc/fstab
# For a description of the file format, see the Users Guide
# http://cygwin.com/cygwin-ug-net/using.html#mount-table

# DO NOT REMOVE NEXT LINE. It remove cygdrive prefix from path
none / cygdrive binary,posix=0,noacl,user 0 0
none /tmp usertemp binary,posix=0,noacl 0 0

Which I think indicates that there's a volume named cygdrive, however I have not found any command that successfully accesses that name.

Possible duplicate question:

@kenorb suggested that this question is a duplicate of Why cwRsync doesn't work on Windows?.

I don't recall seeing this post yesterday, but this one looks the most like mine. I still think it's different because this question was posted in 2011, and this version of rsync is from 2016. The previous version I was using yesterday morning (which was installed in 2015) gave a different error, and prompted me to upgrade my version of git / git bash.

If that question is a duplicate, there is (as of now) no accepted answer, and the top answer doesn't work for me.

In general, all this research led me to believe that there have been several issues with rsync in Windows ports, and that this is only the most current one.

I do think the problem can be solved by me specifying the drive differently... but I don't know what would work. I've tried using the drive name, drive letter, windows colon backslash syntax. Obviously it didn't work, and in the end I'm just guessing.

rsync in msysgit

On 10/18/11 Werner BEROUX said

Is it possible to escape so as to pass "/c/Folder" as argument to an application? Git transforms that to "C:\Folder" by default and it seems I cannot avoid it even by using common escaping methods. https://groups.google.com/forum/#!topic/msysgit/J1hvt9Ave8g

I'm not sure if this is related, I think they're trying to use rsync inside of a git command, but it's interesting that they're having problems with the path names. I wonder if these errors caused by the path being translated to include a :?

Error codes 12 and 255 (Edit on March 21, 2016)

Since someone else (@davidpostill) is saying this is a duplicate as well, I thought I would try the answers / comments in the other question again.

The top voted answers and comments from the other question still didn't work for me, which leads me back to the conclusion that this is a different problem.

Here are the results of trying rsync from the thumb drive, as suggested in the final comment of the top voted answer on the other question:

First I tried using /c/, which is the way to reference drives in other commands in Bash for Windows.

user@computer MINGW32 /e
$ rsync -trd /c/examp/ .
ssh: Could not resolve hostname c: Name or service not known
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/io.c(605) [Receiver=3.0.9]

I got same error with /cygwin prefix:

user@computer MINGW32 /e
$ rsync -trd /cygwin/c/examp/ .
ssh: Could not resolve hostname c: Name or service not known
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/io.c(605) [Receiver=3.0.9]

Tried various types of adding c:, but as it's been pointed out in the past, the colon makes rsync think it's a remote connection, and so that fails with error 255.

user@computer MINGW32 /e
$ rsync -trd /c:/examp/ .
ssh: Could not resolve hostname c: Name or service not known
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/io.c(605) [Receiver=3.0.9]
6

2 Answers 2

1

Two years later, I've found an answer that seems to work on my latest computer (Windows 10, 64 bit).

  1. Install git bash for Windows
  2. Download rsync from futureware.at*
  3. Extract to anywhere, I choose C:\rsync-3.1.2-2-x86_64.pkg
  4. Add the bin folder to the top of your system path

* I do not know who is behind futureware.at, I would prefer to link to a more primary source.

I have also posted the answer here in response to a more general question, because I couldn't remember where this question was at the time.

0

From http://repo.msys2.org/msys/x86_64/ download the following packages:

http://repo.msys2.org/msys/x86_64/rsync-3.1.3-1-x86_64.pkg.tar.xz
http://repo.msys2.org/msys/x86_64/msys2-runtime-3.0.7-6-x86_64.pkg.tar.xz
http://repo.msys2.org/msys/x86_64/zlib-1.2.8-3-x86_64.pkg.tar.xz
http://repo.msys2.org/msys/x86_64/libiconv-1.16-1-x86_64.pkg.tar.xz

Unpack each with tar -xf, and then from usr/bin copy rsync.exe, msys-2.0.dll, msys-z.dll and msys-iconv-2.dll into the directory from where you wish to run rsync. Test with rsync.exe -h.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .