Copy files to a (remote) machine running an SSH daemon with 'rsync'.
rsync has to be installed on the local and remote system.
rsync must be able to connect to the host without password (e.g. public key authentication)
npm install grunt-rsync-2
grunt.js file add :
and a task named
rsync (see Configuration)!
Add a configuration like this:
This will transfer the content of the
dist directory (relative to the current directory) to the host directory
~/production (relative to the user home) on the host
example.com:1023 logged in with
Warning: Files on the remote machine will be overridden
files: defines the files and directories to transfer from local to remote machine.
filescan be an String (supports grunts globbing) or a map of
rsync:deploy:files: 'dist/**/*.jpg' // globbing...
selects all jpg-images from all directories in dist
rsync:deploy:files: 'images/' : 'dist/**/*.jpg' // map <String>:<String>options:...remoteBase: "~/production"
selects all jpg-images from all directories in
dist to remote
rsync:deploy:files: 'images/' : 'dist/images/*.jpg' 'dist/img/*.jpg' // map <String>:[<String>]options:...remoteBase: "~/production"
selects all jpg-images from
img directories in
dist to remote
host: the hostname or ip (ip4/ip6). Default:
port: the port of the ssh server on the host. Default:
user: the user name on the remote to log in with.
remoteBase: the path from root (defined by the ssh server) to the directory to place the content in. Default:
preserveTimes: keeps the origin timestamp. Default:
preservePermissions: keeps the rights. Default:
compression: transfer with compression. Default:
recursive: transfer the source directory recursivly Default:
additionalOptions: rsync commandline arguments (see
man rsync) Default:
Copyright (c) 2012 Jan-Philip Loos Licensed under the MIT license.