sshpass and rsync

Vu Nam Hung
Jul 20, 2017 · 1 min read
  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();
} );

Vu Nam Hung

Ghi chép linh tinh

)
Vu Nam Hung

Written by

Coder, *nixer, Music lover

Vu Nam Hung

Ghi chép linh tinh

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade