![通过 deploy.sh 脚本部署项目时出错](https://linux22.com/image/1051798/%E9%80%9A%E8%BF%87%20deploy.sh%20%E8%84%9A%E6%9C%AC%E9%83%A8%E7%BD%B2%E9%A1%B9%E7%9B%AE%E6%97%B6%E5%87%BA%E9%94%99.png)
我需要帮助。我有在 Ruby 上部署项目的脚本。
#!/bin/sh
if [ $# -eq 0 ]; then
echo "Usage:"
echo " ./deploy.sh some_stage_name"
else
rvm use `cat .ruby-version`@`if [ -f .ruby-gemset ]; then cat .ruby-gemset; fi;` do bundle exec cap $@ deploy &&
cd ./legacy &&
rvm use `cat .ruby-version`@`if [ -f .ruby-gemset ]; then cat .ruby-gemset; fi;` do bundle exec cap $@ deploy &&
cd ..
fi;
如果我通过 cap servername deploy 运行它,它就会正常工作。但如果我运行它./deploy.sh servername
,就会出现错误。
The deploy has failed with an error: #<SSHKit::Runner::ExecuteError: Exception while executing on host 1.2.3.4: "\xE2" from ASCII-8BIT to UTF-8
我只在一台服务器上遇到此错误。此服务器上全局安装了 rvm。如何解决此问题。谢谢。
答案1
问题出在 exec bundle 文件中。我有评论。替换后一切正常。