简体   繁体   中英

Download remote assets with grunt-ssh

I've implemented grunt-ssh plugin in order to download assets from the remote server but with no luck. There're no files listed for download.

Official grunt-ssh site has no explanation about the download method, there're few issue threads only.

My code looks like:

sftp: {
    options: {
        host: 'assets.xxxxx.xx',
        path: '/',
        port: 22,
        username: 'xxxx',
        privateKey: grunt.file.read('/home/xxxxxx/.ssh/id_rsa'),
        passphrase: 'xxxxxx',
        createDirectories: true,
        directoryPermissions: parseInt(755, 8),
        srcBasePath: '/home/files/assets/',
        destBasePath: '/app/',
        showProgress: true,
        mode: 'download'
    },
    files: {
        'images/': 'images/*'
    }
}

There's no error during sftp execute, connection is established successfully. I've tried changing paths in many ways but still no files for download.

Can someone help or point out for some another grunt ssh plugin.

As grunt-ssh plugin is not well maintained and it's pretty overkill for this task, I solved this with just simple shell command:

scp -r files@assets.xxxxx.xx:/home/files/assets/images/* src/images/

This is done with grunt-shell plugin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM