windows - 来自 Windows 客户端的 grunt-rsync 失败

标签 windows gruntjs rsync

我想使用 Grunt 和 rsync 将一些代码从我的计算机 (Windows) 部署到服务器 (Linux)。

我的 Gruntfile.js

module.exports = function(grunt) {

    grunt.initConfig({

        rsync: {
            options: {
                args: ['--verbose', '--chmod=777'],
                exclude: ['*.git', 'node_modules'],
                recursive: true
            },
            production: {
                options: {
                    src: './bitzl.com',
                    dest: '/home/marcus/bitzl.com',
                    host: 'marcus@bitzl.com',
                    syncDest: true
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-rsync');
}

请注意,我使用 marcus 的主目录和 chmod=777 只是为了简化测试。

运行 grunt rsync 失败:

Running "rsync:production" (rsync) task
rsyncing ./example.com >>> /home/marcus/bitzl.com
Shell command was: rsync ./bitzl.com marcus@bitzl.com:/home/marcus/bitzl.com --rsh ssh --recursive --delete --delete-exc
luded --exclude=*.git --exclude=node_modules --verbose --chmod=777
ERROR
Error: rsync exited with code 12
Warning: Task "rsync:production" failed. Use --force to continue.
Error: Task "rsync:production" failed.
    at Task.<anonymous> (D:\git\bitzl.com\node_modules\grunt\lib\util\task.js:200:15)
    at null._onTimeout (D:\git\bitzl.com\node_modules\grunt\lib\util\task.js:236:33)
    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

Aborted due to warnings.

但是,在没有 Grunt 的情况下从上面运行 rsync 命令工作正常:

rsync ./bitzl.com marcus@bitzl.com:/home/marcus/bitzl.com --rsh ssh --recursive --delete --delete-excluded --exclude=*.git --exclude=node_modules --verbose --chmod=777

Rsync 会提示输入我的公钥的密码(通过 Grunt 它不会)并像微风一样同步。

服务器上的身份验证通过公钥(带密码)进行。密码验证也可以。

我的猜测是密码提示以某种方式被破坏并且 rsync 失败并出现协议(protocol)错误(即 exit code 12 )。

要让 grunt-rsync 在 Windows 上运行,我缺少什么?

更新:

在 Linux VM(通过 Virtualbox/Vagrant 的 Ubuntu 12.04)中,它的工作方式与预期的一样。

最佳答案

原来是 grunt-rsync 中的一个错误。我为 rsyncwrapper 填写的拉取请求已被接受,并且使用最新版本的 grunt-rsync 一切都按预期工作。

如果您仍然遇到问题,请确保您至少安装了 grunt-rsync 版本 0.6.0。

关于windows - 来自 Windows 客户端的 grunt-rsync 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23564277/

相关文章:

networking - 如何将 rsync 绑定(bind)到特定接口(interface)?

c++ - 为什么我用 WriteFile 写入文件的每个字符之间都有一个空白?

javascript - 为什么 Grunt 在丑化时忽略 jQuery?

javascript - 如何在版本更改时重新加载资源(HTML/CSS/JS)

javascript - 批量修复 JSHints 在项目中发现的缺失分号

linux - Rsync 复制整个目录内容而不是单个文件

git - Rsync 到 Jenkins 的 Google 计算引擎实例

c++ - MinGW-w64 OpenGL 链接器错误

c++ - 在动态加载的 dll 中查找名称错误的函数

Java语法缺陷