FTP for gulp/grunt tasks?

  • Posted April 23, 2014

I am trying to upload files as a gulp task

gulp.task('ftp', function () {
    return gulp.src('public/js/myapp.js')
            host: '',
            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.


you can ssh into your account and find out your absolute path with the command pwd.

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

22 is usually port for SSH/SFTP protocol, not FTP. try connecting to port 21 if it’s open, otherwise use instead of gulp-ftp

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. <br> <br>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. <br> <br>I wonder if there is something I need to do configuration wise?

Are you using the gulp-ftp plugin? <br> <br> <br> <br>There is a “remotePath” path option you can use. So it would look like: <br> <br><pre> <br>gulp.task(‘ftp’, function () { <br> return gulp.src(‘public/js/myapp.js’) <br> .pipe(tasks.ftp({ <br> host: ‘’, <br> user: ‘USER’, <br> pass: ‘PASS’, <br> port: 22, <br> remotePath: ‘/var/www/mysite’ <br> })); <br>}); <br></pre> <br>