Jenkins 持续部署报错
Jenkins continuous deployment error
我正在学习 Jenkins CI 按照优秀教程中的说明进行测试和部署 http://code.tutsplus.com/tutorials/setting-up-continuous-integration-continuous-deployment-with-jenkins--cms-21511
在教程结束时,它应该会处理应用程序的部署...
根据部署脚本和 Jenkins 项目配置 w ./script/deploy
#!/bin/sh
ssh app@my.server.ip <<EOF
cd ~/hello-jenkins
git pull
npm install --production
forever restartall
exit
EOF
测试正常,但部署在 git pull
上引发错误。
我应该在 git pull
之前做一个 git commit -f
吗?
error: Your local changes to the following files would be overwritten by merge:
app.js
在 Jenkins 控制台输出中列出。我不明白为什么...
./script/test
GET /
✓ respond with Hello Jenkins (41ms)
1 passing (56ms)
+ ./script/deploy
Pseudo-terminal will not be allocated because stdin is not a terminal.
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-52-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Sat Jun 13 06:32:35 EDT 2015
System load: 0.0 Processes: 74
Usage of /: 9.1% of 19.56GB Users logged in: 0
Memory usage: 25% IP address for eth0: 46.101.165.112
Swap usage: 0%
Graph this data and manage this system at:
https://landscape.canonical.com/
38 packages can be updated.
17 updates are security updates.
Updating 784e256..a4095a8
error: Your local changes to the following files would be overwritten by merge:
app.js
Please, commit your changes or stash them before you can merge.
Aborting
[32minfo[39m: Forever restarted processes:
[90mdata[39m: [37m [39m [37muid[39m [90mcommand[39m [90mscript[39m [37mforever[39m [37mpid[39m [37mid[39m [35mlogfile[39m [33muptime[39m
[90mdata[39m: [0] uvyu [90m/usr/local/bin/node[39m [90mapp.js[39m 4271 13896 [35m/home/app/.forever/uvyu.log[39m [33m0:0:1:42.664[39m
Finished: SUCCESS
您遇到此错误是因为您在本地编辑了 app.js
文件。因此,如果您执行命令 git pull
,git 将从远程服务器拉取最新更新,结果,此操作将覆盖您的本地版本,因此 git 抛出错误消息:
error: Your local changes to the following files would be overwritten by merge:
app.js
您可以通过发出命令来提交本地更改:
git add .
git commit -m "some msg here"
或者如果您不想提交本地更改,则可以通过发出命令临时保存本地更改:
git stash
快速阅读您粘贴的 link 后,我相信您的情况应该选择 git commit
而不是 git stash
。
我正在学习 Jenkins CI 按照优秀教程中的说明进行测试和部署 http://code.tutsplus.com/tutorials/setting-up-continuous-integration-continuous-deployment-with-jenkins--cms-21511
在教程结束时,它应该会处理应用程序的部署... 根据部署脚本和 Jenkins 项目配置 w ./script/deploy
#!/bin/sh
ssh app@my.server.ip <<EOF
cd ~/hello-jenkins
git pull
npm install --production
forever restartall
exit
EOF
测试正常,但部署在 git pull
上引发错误。
我应该在 git pull
之前做一个 git commit -f
吗?
error: Your local changes to the following files would be overwritten by merge:
app.js
在 Jenkins 控制台输出中列出。我不明白为什么...
./script/test
GET /
✓ respond with Hello Jenkins (41ms)
1 passing (56ms)
+ ./script/deploy
Pseudo-terminal will not be allocated because stdin is not a terminal.
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-52-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Sat Jun 13 06:32:35 EDT 2015
System load: 0.0 Processes: 74
Usage of /: 9.1% of 19.56GB Users logged in: 0
Memory usage: 25% IP address for eth0: 46.101.165.112
Swap usage: 0%
Graph this data and manage this system at:
https://landscape.canonical.com/
38 packages can be updated.
17 updates are security updates.
Updating 784e256..a4095a8
error: Your local changes to the following files would be overwritten by merge:
app.js
Please, commit your changes or stash them before you can merge.
Aborting
[32minfo[39m: Forever restarted processes:
[90mdata[39m: [37m [39m [37muid[39m [90mcommand[39m [90mscript[39m [37mforever[39m [37mpid[39m [37mid[39m [35mlogfile[39m [33muptime[39m
[90mdata[39m: [0] uvyu [90m/usr/local/bin/node[39m [90mapp.js[39m 4271 13896 [35m/home/app/.forever/uvyu.log[39m [33m0:0:1:42.664[39m
Finished: SUCCESS
您遇到此错误是因为您在本地编辑了 app.js
文件。因此,如果您执行命令 git pull
,git 将从远程服务器拉取最新更新,结果,此操作将覆盖您的本地版本,因此 git 抛出错误消息:
error: Your local changes to the following files would be overwritten by merge:
app.js
您可以通过发出命令来提交本地更改:
git add .
git commit -m "some msg here"
或者如果您不想提交本地更改,则可以通过发出命令临时保存本地更改:
git stash
快速阅读您粘贴的 link 后,我相信您的情况应该选择 git commit
而不是 git stash
。