Jenkins Git 推送分支时发布失败;没有显示标准错误

Jenkins Git Publish fails when pushing a branch; no stderror shown

我们的构建包含一个本地 shell 命令,它根据启动构建的参数创建一个本地 git 分支。将文件复制到目的地后,目标是将新分支推送到存储库,这样如果将来对该分支有更新,就可以拉取它们。在我创建的 post 构建和要推送的分支中,两者都以错误结尾

using GIT_ASKPASS to set credentials PAT (****)
 > /usr/bin/git push *GITURL* HEAD:UAT-sprint-20-96 -f # timeout=10
ERROR: Failed to push branch UAT-sprint-20-96 to origin
hudson.plugins.git.GitException: Command "/usr/bin/git push *GIT_URL* HEAD:UAT-sprint-20-96 -f" returned status code 128:
stdout: 
stderr: 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2450)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2051)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access0(CliGitAPIImpl.java:84)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:2536)
    at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:316)
    at hudson.tasks.BuildStepMonitor.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:753)
    at hudson.model.Build$BuildExecution.post2(Build.java:177)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:698)
    at hudson.model.Run.execute(Run.java:1932)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Build step 'Git Publisher' marked build as failure

(GIT_URL 只是为了保护隐私,我替换了实际的 URL) stderr 中没有实际错误,因此很难弄清楚它失败时会发生什么。 运行在服务器 CLI 中使用实际命令工作正常,询问用户名和密码。该服务器没有实际的 public IP;它的上网是通过我们公司的网络。我可以克隆存储库这一事实表明这不是连接问题,但我可能是错的。我环顾四周,看看是否有人遇到过这个问题,但我发现的与管道作业有关(事实并非如此)。我们还尝试使用“运行 a shell 脚本”选项推送分支,但它失败了,即使将用户名和令牌包含到 URL 中也是如此。有人遇到过这个吗?我们使用 Azure Dev Ops 作为我们的 git。任何见解都会有所帮助。谢谢。

事实证明这是我的配置错误。 Jenkins 配置,出于某种我无法理解的原因,正在将早期值传递或连接到分支名称中,这导致 Git 分支 (UAT-sprint-20-96) 不存在。