-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

相关推荐
一直在努力学习的菜鸟11 小时前
基于 GitLab Webhook 实现 Jenkins 自动化构建(Pipeline 版)
jenkins
伊布拉西莫1 天前
从静态参数到动态复用:Jenkins Parameters、Active Choices 与 Scriptler 实战指南
java·servlet·jenkins·devops
SEO_juper5 天前
HTTPS 混合内容检查工具:页面全站 https 了,但还有 http 资源在拖后腿
开发语言·网络协议·http·https·node.js·json·bash
深频率7 天前
补丁还在排队,AI先替服务器挡了一刀
服务器·人工智能·jenkins
BullSmall11 天前
Jenkins Git插件报错?6步修复+预防指南
运维·jenkins
mylove_北极甜虾17 天前
jenkins-01Jenkins 架构与任务调度
运维·jenkins
SEO_juper18 天前
Node.js 全站 SEO 体检报告生成器:一次查完标题、描述、canonical、H1、图片
开发语言·前端·node.js·html·bash
时间的拾荒人20 天前
Shell 脚本核心语法详解(下篇):流程控制、函数、重定向与文件包含
linux·运维·服务器·bash·脚本编程
蜗牛一步步往上爬20 天前
第四章 更多的bash shell命令
linux·开发语言·bash
筑梦之人20 天前
Elasticsearch 9.x 从入门到精通(4/7):聚合分析与文本分析
大数据·elasticsearch·jenkins