[英]Unable to create branch using jenkins pipeline script
我創建了下面的腳本來從開發創建發布/測試分支並將其推送到遠程。
stage('create branch')
{
stdout = sh(script:'git checkout -b release/test3', returnStdout: true)
println("GIT add stdout ################ " + stdout + " ####################")
withCredentials([usernamePassword(credentialsId: 'gitlogin', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')])
{
sh('git push origin release/test3')
}
}
正在本地創建分支,但我無法將其推送到遠程。
以下是錯誤消息:
+ git checkout -b release/test3
Switched to a new branch 'release/test3'
[Pipeline] echo
GIT add stdout ################ ####################
[Pipeline] withCredentials
Masking supported pattern matches of %GIT_USERNAME% or %GIT_PASSWORD%
[Pipeline] {
[Pipeline] sh
+ git push origin release/test3
Could not create directory '/c/Jenkins/jobs/ssa_mode/workspace/%HOMEDRIVE%%HOMEPATH%/.ssh'.
percent_expand: unknown key %H
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
請幫助解決問題。
Jenkinsfile 中的sh()
步驟適用於Jenkinsfile
代理。 由於您在 Windows 代理上運行此程序,請將所有出現的sh()
替換為bat()
以實現%HOMEDRIVE%%HOMEPATH%
的正確變量擴展。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.