-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

相关推荐
橘色的喵9 小时前
Claude Code 状态栏脚本:一行显示模型、上下文占用、git 分支和当前目录
linux·git·bash·claude
zhangzeyuaaa9 小时前
AI Agent 执行引擎选型指南:PowerShell / Bash 和 Python,边界与最佳实践
人工智能·python·bash
qq_3494479510 小时前
jenkin节点创建
jenkins
飞翔的熊blabla2 天前
# Webpack 5 + Jenkins 持久化缓存实战:前端构建从 288 秒降到 30 秒>
前端·webpack·jenkins
典典分享指南2 天前
用结构化数据管理产品知识库
scala·bash·batch·actionscript
海兰3 天前
Elasticsearch ES|QL:让全文本搜索无处不在
大数据·elasticsearch·jenkins
IT界的老黄牛4 天前
Jenkins 监控一条龙:接入、看板 9964、11 条告警规则直接抄走
jenkins·grafana·prometheus·监控·ci-cd·告警规则
小袁拒绝摆烂4 天前
Jenkins部署经验
运维·jenkins
典典分享指南4 天前
一品牌多产品线的 GEO 内容矩阵:从策略到落地
java·c#·bash·symfony
IT界的老黄牛4 天前
Jenkins 构建卡了 23 天,abort 按钮点了没用
jenkins·maven·prometheus·告警·排查·ci-cd