-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

相关推荐
kaixin_learn_qt_ing2 小时前
Jenkins
运维·jenkins
Madison-No720 小时前
Jenkins持续集成
运维·ci/cd·jenkins
qetfw1 天前
Bash 基础:脚本执行、引号与命令替换验证
linux·开发语言·chrome·bash
qetfw2 天前
Bash 变量:export、位置参数与默认值展开验证
linux·开发语言·chrome·bash
ZYH_06012 天前
rhcsa课程复习题
服务器·bash
boy快快长大2 天前
【Jenkins】入门学习
运维·学习·jenkins
oioihoii2 天前
Jenkins自动部署全流程:CentOS 7、GitHub、Gitee、GitLab、Vue+Maven与Webhook
centos·github·jenkins
qetfw3 天前
Bash 字符串处理:参数展开、序列与脚本执行方式
linux·开发语言·chrome·bash
Geek-Chow3 天前
Building and Using a Jenkins Shared Library
jenkins
flytalei3 天前
逐浪笔记 GitOps 实战:Jenkins 构建、Argo CD 同步与 Git 回滚
笔记·git·jenkins