-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

相关推荐
三劫散仙17 小时前
kubernetes jenkins pipeline优化拉取大仓库性能指定分支+深度
容器·kubernetes·jenkins
vortex51 天前
探索 Shell:选择适合你的命令行利器 bash, zsh, fish, dash, sh...
linux·开发语言·bash·shell·dash
zmm04203 天前
Could not get unknown property ‘mUser‘ for Credentials [username: null]
jenkins·gradle
背太阳的牧羊人3 天前
sudo docker exec -it backend bash 以交互方式(interactive)进入正在运行的 Docker 容器的命令行环境
docker·容器·bash
keson要进步3 天前
CICD实战(一) -----Jenkins的下载与安装
运维·ci/cd·centos·自动化·jenkins
新兴AI民工3 天前
windows上的visual studio2022的项目使用jenkins自动打包
windows·jenkins·visual studio
风早君3 天前
jenkins集成gitlab发布到远程服务器
服务器·gitlab·jenkins
Thanks_ks3 天前
SpringBoot 自动化部署实战:CI/CD 整合方案与避坑指南
pipeline·jenkins·springboot·自动化部署·gitlab ci/cd·ci/cd 实战·docker 容器化
爱宇阳3 天前
使用 Docker Compose 部署 Jenkins(LTS 版)持续集成环境
ci/cd·docker·jenkins
π大星星️3 天前
Jenkins 工作流程
运维·jenkins