-bash: ./deploy.sh: /bin/bash^M: bad interpreter: No such file or directory

文章目录

场景

jenkins 发布失败, 报错ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [126]], 这说明远程服务器的deploy.sh执行失败, 首先检查权限,没有发现问题,然后手动执行一遍又报错"-bash: ./deploy.sh: /bin/bash^M: bad interpreter: No such file or directory", 这个意味着脚本是windows回车符结尾

txt 复制代码
[JENKINS] Archiving /home/vagrant/.jenkins/workspace/jenkinsDemo/target/jenkinsDemo-1.0-SNAPSHOT.jar to com.carsonlius/jenkinsDemo/1.0-SNAPSHOT/jenkinsDemo-1.0-SNAPSHOT.jar
channel stopped
SSH: Connecting from host [ubuntu-xenial]
SSH: Connecting with configuration [107.173.111.224 自己] ...
SSH: EXEC: completed after 604 ms
SSH: Disconnecting configuration [107.173.111.224 自己] ...
ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [126]]
Build step 'Send build artifacts over SSH' changed build result to UNSTABLE

解决

sed -i -e 's/\r$//' deploy.sh

相关推荐
2501_906150569 小时前
开源问卷平台DWSurvey开发配置记录
运维·开源·jenkins
ASEpochs10 小时前
Vsocde中‘sh’不是内部或外部命令,也不是可运行的程序或批量处理文件--已解决
git·vscode·bash
一点晖光12 小时前
jenkins 流水线脚本
运维·jenkins
num_killer15 小时前
小白的Jenkins学习
运维·python·学习·jenkins
dessler18 小时前
Elasticsearch(ES)备份与快照(Snapshot)
大数据·elasticsearch·jenkins
北京流年18 小时前
windows安装jenkins并且编译app
运维·windows·jenkins
叠叠乐18 小时前
bash sh为什么终端不能tab补全
开发语言·bash
Ken_111519 小时前
CentOS7升级GNU Bash
bash
h***381820 小时前
Java进阶(ElasticSearch的安装与使用)
java·elasticsearch·jenkins
摇滚侠20 小时前
一小时Jenkins教程
运维·jenkins