简体   繁体   English

使用grunt-ssh下载远程资产

[英]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. 我已经实现了grunt-ssh插件,以便从远程服务器下载资产,但是没有运气。 There're no files listed for download. 没有列出要下载的文件。

Official grunt-ssh site has no explanation about the download method, there're few issue threads only. grunt-ssh官方网站没有有关下载方法的解释,只有很少的发行主题。

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. sftp执行期间没有错误,连接成功建立。 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. 有人可以帮忙还是指出另一个grunt ssh插件。

As grunt-ssh plugin is not well maintained and it's pretty overkill for this task, I solved this with just simple shell command: 由于grunt-ssh插件的维护不当,并且对于此任务而言过于矫kill过正,因此我仅通过简单的shell命令即可解决此问题:

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

This is done with grunt-shell plugin. 这是通过grunt-shell插件完成的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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