-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

相关推荐
小安同学iter8 小时前
三台服务器,一套流水线:如何实现无缝自动化部署?
gitlab·jenkins
...对方正在输入......1 天前
Elasticsearch集群部署实战指南
elasticsearch·jenkins
程序员潇潇1 天前
Jenkins 插件下载速度慢安装失败?这篇文章可能解决你头等难题!
运维·自动化测试·软件测试·功能测试·程序人生·职场和发展·jenkins
ζั͡山 ั͡有扶苏 ั͡✾1 天前
EFK 日志系统搭建完整教程
运维·jenkins·kibana·es·filebeat
小晶晶京京2 天前
day62-gitlab和JenKins
运维·gitlab·jenkins
张志翔的博客2 天前
如何在 macOS 上切换 Shell:从 Bash 到 Zsh 或其他 Shell
开发语言·macos·bash
zhengqiqiqinqin2 天前
reboot提示 -bash: fork: retry: 没有子进程
开发语言·bash
奔跑吧邓邓子2 天前
Jenkins自动化持续集成:从入门到实战
ci/cd·自动化·实战·jenkins·自动化持续集成
e***0963 天前
Springboot中使用Elasticsearch(部署+使用+讲解 最完整)
spring boot·elasticsearch·jenkins
Better Bench3 天前
Elasticsearch BM25 检索器连接问题解决方案
大数据·elasticsearch·jenkins