jerrysu / gulp-rsync

Gulp plugin for deploying files via rsync
119 stars 51 forks source link

Is it possible to use ssh keys other than the default? #53

Open ddoddsr opened 6 years ago

ddoddsr commented 6 years ago

I can rsync (using the same key I use to ssh), like this from the command line: rsync -r -a -v -e "ssh -i ~/.ssh/my-key-local-dev" & etc

How would I add the path to my public key to gulp-rsync config option?

sangtcao commented 5 years ago

Just recently came into this issue and managed to put it together. Since no one else on the web posted a solution, figured I'd do my duty here and pass it along. Hope it can still be useful to others:

gulp-rsync doesn't support this by default, but back in 2015 there was an added feature for any custom options when running the command (https://github.com/jerrysu/gulp-rsync/issues/17). You can attach the -e option to your shell command like so:

var gulp = require('gulp');
var rsync = require('gulp-rsync');

gulp.task('deploy', function() {
  gulp.src('build/**')
    .pipe(rsync({
      username: 'user',
      hostname: 'host',
      destination: '~/',

      options: {
        "e": "ssh -i <local-path-to-key-file>"
      }

    }));
});