我想使用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 promts用于我的公钥密码(通过Grunt它没有)和同步就像微风一样。
服务器上的身份验证是通过公钥(使用密码)进行的。密码认证也可以。
我的猜测是,由于协议错误(即exit code 12),密码promt中断,rsync失败。
在Windows环境下,我错过了什么?
更新:
从Linux (Ubuntu12.04通过Virtualbox/Vagrant),它的工作方式与on预期的一样。
发布于 2015-02-02 12:54:16
结果是在咕噜-rsync中的一个错误。我为rsyncwrapper填写的拉请求已经被接受,最近版本的grunt-rsync一切都如预期的那样工作。
如果您仍然遇到问题,请确保至少安装了grunt-rsync版本0.6.0。
https://stackoverflow.com/questions/23564277
复制相似问题