-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

相关推荐
qq_白羊座1 小时前
GitLab CI + Jenkins 双流水线模式Jenkins 端配置
ci/cd·gitlab·jenkins
D4c-lovetrain2 小时前
Jenkins自动化部署PHP项目
自动化·jenkins·php
qq_白羊座2 小时前
GitLab CI 与 Jenkins
ci/cd·gitlab·jenkins
console.log('npc')2 小时前
git发版上线的时候,打tag标签方便jenkins部署
运维·git·jenkins
lisanmengmeng2 小时前
gitlab 配置的jenkins 链接错误
运维·gitlab·jenkins
Cat_Rocky3 小时前
Linux-Jenkins自动化部署PHP项目
linux·自动化·jenkins
承渊政道1 天前
【MySQL数据库学习】(MySQL库的操作和表的操作)
数据库·学习·mysql·ubuntu·bash·数据库架构·数据库系统
RemainderTime1 天前
打破容器孤岛:如何基于 Docker Network 构建内网安全隔离的 CI/CD 部署闭环
运维·网络·nginx·docker·jenkins
IMPYLH2 天前
Linux 常用命令列表
linux·运维·服务器·bash
承渊政道2 天前
【MySQL数据库学习】(MySQL数据库基础)
数据库·学习·mysql·ubuntu·bash·数据库架构·数据库系统