小编Nat*_*lia的帖子

Jenkins Pipeline Groovy 脚本:批处理脚本问题“%20”被替换为“0”

我有一个使用带有空格的 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

git groovy jenkins jenkins-pipeline

2
推荐指数
1
解决办法
4215
查看次数

标签 统计

git ×1

groovy ×1

jenkins ×1

jenkins-pipeline ×1