我有一个使用带有空格的 git URL 的管道脚本https://username:password@project-teamprojects.visualstudio.com/defaultcollection/_git/Core - Stream:
node ("master") {
bat([script: "git push https://username:password@project-teamprojects.visualstudio.com/defaultcollection/_git/Core%20-%20Stream", encoding: "UTF-8" ])
}
Run Code Online (Sandbox Code Playgroud)
当执行此 jenkins 作业时,它会失败,因为'%20'被替换为'0'. 日志说:
git push https://username:password@project-teamprojects.visualstudio.com/defaultcollection/_git/Core0-0Stream
remote: TF401019: The Git repository with name or identifier Core0-0Stream does not exist or you do not have permissions for the operation you are attempting.
fatal: repository 'https://username:password@project-teamprojects.visualstudio.com/defaultcollection/_git/Core0-0Stream/' not found
Run Code Online (Sandbox Code Playgroud)
如何在 jenkins 管道脚本中使用bat 任务正确编码 git url