在詹金斯执行RSYNC

时间:2014-09-10 00:12:00

标签: linux jenkins continuous-integration web-deployment jenkins-plugins

大家好,所以我试图将我的代码部署到远程服务器..到目前为止,我已经尝试了

  • 通过SSH插件发布:但问题是我无法保留文件权限
  • 我觉得Rsync命令是文件权限更好的原因,唯一的问题就是我不知道如何设置密码让它自动运行

这就是我得到的

[JenkinsBuild] $ /bin/sh -xe /var/lib/jenkins/tmp/hudson4646064064846581974.sh
+ rsync -PSauve ssh --exclude=JenkinsBuild app bower.json config gruntfile.js karma.conf.js LICENSE.md Makefile node_modules package.json Procfile protractor.conf.js public README README.md server.js john@192.168.2.10:/srv/dp/prod
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(600) [sender=3.0.6]

任何想法我在这里做错了什么 ?

1 个答案:

答案 0 :(得分:2)

最好的方法是将本地公共ssh密钥复制到远程主机。然后通过您的密钥而不是密码进行身份验证

只需在你的jenkins上运行ssh-copy-id user @ host。

然后不应再出现问题:)