Skip to content

Instantly share code, notes, and snippets.

@chebaby
Last active October 17, 2018 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chebaby/6de27f1720728de7a38197654ec41d43 to your computer and use it in GitHub Desktop.
Save chebaby/6de27f1720728de7a38197654ec41d43 to your computer and use it in GitHub Desktop.
SSH and Rsync within Cygwin

Cygwin Setup

This is not an in-depth guide for installing Cygwin; although, installing Cygwin is a fairly simple process. In or to implement SSH and rsync functionality, a few non-default Cygwin packages will need to be installed.

  1. Download and run the Cygwin setup.exe program from http://cygwin.com/install.html

    If you already have Cygwin installed, that should not be a problem. You can still run setup.exe to install additional Cygwin packages.

  2. Proceed through the Cygwin setup process until you get to the "Select Packages" screen. From there, make sure the following packages are selected:

    • Net -> openssh
    • Net -> rsync
    • Admin -> cygrunsrv
    • Editors -> nano (optional, but I find it to be a very simple text editor to use in place of vi or emacs)
    • Web -> wget (optional, but useful for downloading files without a browser)
  3. Finish the Cygwin setup wizard allowing the selected packages, including any required dependency packages, to be installed.

source


The command i use to sync local files with server files

I mostly use windows in local, so this is the command line i use to sync files with the server (debian) :

user@user-PC /cygdrive/c/wamp64/www/projects

$ rsync -rptgoDvhnP --chown=www-data:www-data --exclude=.env --exclude=vendor --exclude=node_modules --exclude=.git --exclude=tests --exclude=.phpintel --exclude=storage ./website/ username@hostname:/var/www/html/website

the flag -a or --archive is a shortcut to flags -rlptgoD

note: -n : perform a trial run with no changes made, to really execute the command remove the -n option

-r for a recursive copy (folders)

-l copy the symbolic links.

-p keep the permissions.

-t keeps the date of modifications (necessary for the proper functioning of the difference algorithm).

-g keeps the group to which the file belongs.

-o retains the owner to which the file belongs.

-D preserves special files and device files.

Ressources

documentation

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