sshpass and rsync

Vu Nam Hung
Vu Nam Hung
Published in
1 min readJul 20, 2017
  1. Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2. Install sshpass

brew create https://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz --force

will create a formula which you then can use normally as

brew install sshpass

3. Write gulp task

gulp.task( 'push:themes', function( done ) {
var cmd = 'sshpass -p ' + remote.password + ' rsync -avzhe ssh --delete -L ' + paths.local.themes + ' ' + paths.remote.themes;
exec( cmd, function( error, stdio, stderr ) {
console.log( 's: ' + stdio + '\n' );
console.log( 'e: ' + stderr + '\n' );
} );
done();
} );

--

--