Rsync Deploy and Windows 10

If you like the command line (cli), here are 2 other options - if you are on windows 10:

Windows Subsystem for Linux


(I tested ubuntu)

you will end up in an ubuntu system (no gui), which you will have to
update yourself.
ssh, rsync are included.

cmder + git-for-windows + rsync

1)

http://cmder.net/ (Download Full)
=> console + git-for-windows

(I extracted to C:\Apps\cmder)

2)

review:
https://blog.tiger-workshop.com/add-rsync-to-git-bash-for-windows/

If you are OK with it - I had to download
http://repo.msys2.org/msys/i686/rsync-3.1.2-2-i686.pkg.tar.xz
not
http://repo.msys2.org/msys/x86_64/rsync-3.1.2-2-x86_64.pkg.tar.xz

You need 7zip in order to extract (twice)
rsync-3.1.2-2-i686.pkg.tar.xz
=> rsync-3.1.2-2-i686.pkg.tar
=> rsync-3.1.2-2-i686.pkg

You get:

└── usr
    ├── bin
    │   └── rsync.exe
    ├── lib
    │   └── rsync
    │       └── rrsync
    └── share
        └── man
            ├── man1
            │   └── rsync.1.gz
            └── man5
                └── rsyncd.conf.5.gz

Copy usr/bin/rsync.exe to your vendor git usr dir:
C:\Apps\cmder\vendor\git-for-windows\usr

Now you are in.

Here’s a demo. $ prompt is windows cmder shell

ssh keys

$ echo %HOME%
C:\Data\home

$ ls C:\Data\home\.ssh
id_dsa
id_dsa.keystore
id_dsa.pub
known_hosts

versions

$ git version
git version 2.11.0.windows.1
$ which rsync
/usr/bin/rsync
$ rsync --version
rsync  version 3.1.2  protocol version 31
Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, no xattrs, iconv, symtimes, prealloc

prepare new directory on linux host

# zama1 is a linux host (IP in my etc/hosts)

$ ssh root@zama1
Enter passphrase for key '/c/Data/home/.ssh/id_rsa':

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jan 22 21:09:25 2018 from ~~~ cut

# group sticky bit is set!
# was: chmod g+s /srv/www/
root@zama1: # ls -ld /srv/www/
drwxr-sr-x 19 www-data www-data 4096 Jan 22 21:14 /srv/www/


root@zama1:~# mkdir /srv/www/test
# user www1 must exist
root@zama1:~# chown www1:www-data /srv/www/test
root@zama1:~# exit
logout
Connection to zama1 closed.

using rsync in git-for-windows (cmder shell)

I’m in a directory with a public directroy:

$ rsync -rlt -v --groupmap=*:www-data  public/ www1@zama1:/srv/www/test
Enter passphrase for key '/c/Data/home/.ssh/id_rsa':
sending incremental file list
./
404.html
index.html
...

sent 14,749,142 bytes  received 11,719 bytes  797,884.38 bytes/sec
total size is 14,707,588  speedup is 1.00

# change some files (run hugo)

$ rsync -rlt -v --groupmap=*:www-data  public/ www1@zama1:/srv/www/test
Enter passphrase for key '/c/Data/home/.ssh/id_rsa':
sending incremental file list
pages/showcase/gallery-01/
pages/showcase/gallery-01/index.html

sent 49,066 bytes  received 607 bytes  9,031.45 bytes/sec
total size is 14,740,024  speedup is 296.74

But keep in mind - with both options you are going to need/learn some linux know-how…

1 Like