我有一個Jenkinsfile執行 bash ( sh) 腳本的以下階段:
stage('Prepare') {
sh 'cd ./bin && ./prepare.sh'
}
詹金斯失敗的階段產生錯誤:
14:27:16 cd ./bin 14:27:16 ./prepare.sh 14:27:16 /data/jenkins/workspace/repo_J_tmp/durable-8864902e/script.sh: line 1: ./prepare.sh: Permission denied
我使用 IntelliJ Idea 和 Windows。如何改變和推動權利?
chmod= x ./bin/prepare.shGit Bash 中的命令未注冊為更改,因此無需提交任何內容。
uj5u.com熱心網友回復:
它需要git --update-index與 Git Bash一起使用,然后通過 Windows 命令列執行提交。
命令序列如下(假設安裝了 Git Bash):
PS C:\Development\repo> bash
user@DESKTOP-ABCDEFG:/mnt/c/Development/repo$ git update-index --chmod= x ./docs/prepare.sh
user@DESKTOP-ABCDEFG:/mnt/c/Development/repo$ exit
PS C:\Development\repo> git commit -m"Executable Script"
提交已準備好推送(ctrl shift k或git push)。
另外,請注意行分隔符必須是LR:Unix 和 MacOS 兼容 ( \n),否則/usr/bin/env: ‘bash\r’: No such file or directory顯示為錯誤。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/343938.html
上一篇:如何在Git中恢復其他人的提交?
下一篇:淺談網路損傷對應用開發的影響
