-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

相关推荐
陆鳐LuLu44 分钟前
日志管理利器:基于 ELK 的日志收集、存储与可视化实战
运维·elk·jenkins
[奋斗不止]1 小时前
Jenkins 配置 Credentials 凭证
jenkins·jenkins 配置凭证
[奋斗不止]10 小时前
Jenkins 构建 Unity 打包 .apk 同时生成 .aab
jenkins·jenkins 打包 .aab·jenkins导出aab·jenkisn 导出 apk
boy快快长大10 小时前
【Elasticsearch】同一台服务器部署集群
服务器·elasticsearch·jenkins
深情不及里子10 小时前
纯手工搭建整套CI/CD流水线指南
ci/cd·gitlab·jenkins·harbor
梁萌11 小时前
04-DevOps-安装并初始化Jenkins
运维·jenkins·devops
跳跳的向阳花12 小时前
06、ElasticStack系列,第六章:elasticsearch设置密码
大数据·elasticsearch·jenkins
枫叶落雨2221 天前
08-Elasticsearch
运维·jenkins
web150854159351 天前
Spring Boot(十六):使用 Jenkins 部署 Spring Boot
spring boot·后端·jenkins
m0_748255021 天前
Springboot中使用Elasticsearch(部署+使用+讲解 最完整)
spring boot·elasticsearch·jenkins