首页 > 解决方案 > Jenkins 服务帐户无法从 Git 中提取

问题描述

我遇到了一些从 Jenkins 随机开始的麻烦。我们所有的工作都开始失败,看起来我们用来运行工作的服务帐户存在凭据问题。这是随机开始的。我已经尝试更新 Jenkins 和插件的版本,但没有任何变化。这是我们在任何运行的作业中收到的输出:

 > git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git.exe config remote.origin.url https://site.visualstudio.com/_git/prodscripts # timeout=10
Fetching upstream changes from https://site.visualstudio.com/_git/prodscripts
 > git.exe --version # timeout=10
using GIT_ASKPASS to set credentials site git repo
 > git.exe fetch --tags --progress https://site.visualstudio.com/_git/prodscripts +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://site.visualstudio.com/_git/prodscripts
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:888)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1155)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
    at hudson.scm.SCM.checkout(SCM.java:504)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
    at hudson.model.Run.execute(Run.java:1810)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Caused by: hudson.plugins.git.GitException: Command "git.exe fetch --tags --progress https://site.visualstudio.com/_git/prodscripts +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: Logon failed, use ctrl+c to cancel basic credential prompt.
fatal: Authentication failed for 'https://site.visualstudio.com/_git/prodscripts/'

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2016)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1735)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:420)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:886)
    ... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE

我还确认该服务帐户可以毫无问题地登录到我们的 git 存储库,并确认该帐户的安全权限。我完全不知道詹金斯是如何运作的,并且从别人那里继承了詹金斯,所以我很难找出问题所在。任何帮助将不胜感激。

编辑:我还想补充一点,当我尝试查看作业配置时,我收到以下信息:

詹金斯工作失败

标签: jenkins

解决方案


请确保您使用的是正确的凭据,如果最近发生了更改,请不要忘记在 Jenkins 凭据管理器中更新它。我遇到了类似的问题,但是当我更新密码时 - 它解决了。


推荐阅读