Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/368.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用grunt ssh下载远程资产_Javascript_Ssh_Gruntjs_Grunt Ssh - Fatal编程技术网

Javascript 使用grunt ssh下载远程资产

Javascript 使用grunt ssh下载远程资产,javascript,ssh,gruntjs,grunt-ssh,Javascript,Ssh,Gruntjs,Grunt Ssh,我已经实现了grunt ssh插件,以便从远程服务器下载资产,但运气不好。没有列出要下载的文件 官方grunt ssh站点没有关于下载方法的解释,只有很少的问题线程 我的代码如下所示: sftp: { options: { host: 'assets.xxxxx.xx', path: '/', port: 22, username: 'xxxx', privateKey: grunt.file.read('/

我已经实现了grunt ssh插件,以便从远程服务器下载资产,但运气不好。没有列出要下载的文件

官方grunt ssh站点没有关于下载方法的解释,只有很少的问题线程

我的代码如下所示:

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/*'
    }
}
sftp执行期间没有错误,连接已成功建立。我尝试了多种方式改变路径,但仍然没有可供下载的文件


是否有人可以帮助或指出另一个grunt ssh插件。

由于grunt ssh插件没有得到很好的维护,而且对于这项任务来说,它的技巧相当过火,我只使用简单的shell命令解决了这个问题:

scp -r files@assets.xxxxx.xx:/home/files/assets/images/* src/images/
这是通过插件完成的