FTP for gulp/grunt tasks?

April 23, 2014 4.8k views
I am trying to upload files as a gulp task gulp.task('ftp', function () { return gulp.src('public/js/myapp.js') .pipe(tasks.ftp({ host: '111.111.111.11', user: 'USER', pass: 'PASS', port: 22 })); }); The above does not work because the default path is root, I need to guide it into var/www/mysite I am not sure where to go from here, I am tired of manually uploading my files when I make changes to them. Any help would be much appreciated.
1 comment
  • you can ssh into your account and find out your absolute path with the command pwd.

4 Answers
Are you using the gulp-ftp plugin?

https://github.com/sindresorhus/gulp-ftp

There is a "remotePath" path option you can use. So it would look like:


gulp.task('ftp', function () {
return gulp.src('public/js/myapp.js')
.pipe(tasks.ftp({
host: '111.111.111.11',
user: 'USER',
pass: 'PASS',
port: 22,
remotePath: '/var/www/mysite'
}));
});

Yeah I am, It's not working because event without the remote path (thanks for pointing that out) its not uploading anything to any directory.

The ftp credentials are correct I tested them by connecting to my server with filezilla. I am using filezilla to see if its uploading anything and it's not.

I wonder if there is something I need to do configuration wise?
22 is usually port for SSH/SFTP protocol, not FTP. try connecting to port 21 if it's open, otherwise use https://github.com/gtg092x/gulp-sftp instead of gulp-ftp
Have another answer? Share your knowledge.