首页 > 解决方案 > 詹金斯:rsync文件从目录到同一主机上的另一个

问题描述


我在我的服务器上安装了 jenkins:54.xxx 在 jenkins 中,我有一个构建步骤(shell)来构建 angular 项目并将文件夹复制到同一主机上的 /var/www/ :

npm install
npm run build

rsync -avz --delete  -e 'ssh'  ./dist/* appuser@54.x.x.x:/var/www/mybusiness/dist/

我已经向authorized_keys 添加了公钥。我可以手动执行它并且它可以工作,但是jenkins失败了,我收到了这个错误:

Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(235) [sender=3.1.2]
Build step 'Execute shell' marked build as failure
Finished: FAILURE

标签: shelljenkinsrsync

解决方案


推荐阅读