我正在尝试在64位的windows7和64位的Linux之间同步文件。我在两台机器上都安装了rsync 3.0.7 (windows上的cygwin版本)。
这是我在windows上运行的命令。我看到它正在建立到远程机器的连接,但它只是在身份验证之后和传输文件之前就死了。导致此问题的原因是什么?
rsync -vvvv localfile REMOTE-HOST:~/
FILE_STRUCT_LEN=16, EXTRA_LEN=4
cmd=<NULL> machine=REMOTE-HOST user=guest path=~/
cmd[0]=ssh cmd[1]=-l cmd[2]=guest cmd[3]=REMOTE-HOST cmd[4]=rsync cmd[5]=--server cmd[6]=-vvvvv.Lsf cmd[7]=. cmd[8]=~/
opening connection using: ssh -l guest REMOTE-HOST rsync --server -vvvve.Lsf. "~/"
note: iconv_open("UTF-8", "UTF-8") succeeded.
Password:
FILE_STRUCT_LEN=24, EXTRA_LEN=4
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
[Receiver] _exit_cleanup(code=12, file=io.c, line=601): entered
rsync error: error in rsync protocol data stream (code 12) at io.c(601) [Receive
r=3.0.7]
[Receiver] _exit_cleanup(code=12, file=io.c, line=601): about to call exit(12)
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
[sender] _exit_cleanup(code=12, file=/home/lapo/packaging/rsync-3.0.7-1/src/rsyn
c-3.0.7/io.c, line=601): entered
rsync error: error in rsync protocol data stream (code 12) at /home/lapo/packagi
ng/rsync-3.0.7-1/src/rsync-3.0.7/io.c(601) [sender=3.0.7]
[sender] _exit_cleanup(code=12, file=/home/lapo/packaging/rsync-3.0.7-1/src/rsyn
c-3.0.7/io.c, line=601): about to call exit(12)发布于 2011-02-17 02:35:46
问题是git安装冲突。Git包含了自己的ssh,并且它的路径在cygwin路径之前,所以rsync使用了git的ssh。修复方法是交换git/cygwin bin路径的顺序,以便rsync使用正确版本的ssh。
发布于 2015-09-08 22:49:41
通过在调用中添加ssh的绝对路径,我找到了解决此错误的方法:
rsync -avzphi --chmod=ugo=rwX --checksum --delete-after -e "C:\cwRsync\ssh.exe -p 9999 -i c:\cwRsync\ssh\test_id_rsa" "/cygdrive/c/repository/blah.com/" test@xx.xx.xxx.xxx:/home/test/public_html
https://stackoverflow.com/questions/4892125
复制相似问题