【问题标题】:Credentials issue on Windows slave node fetching from Git repo从 Git 存储库获取的 Windows 从属节点上的凭据问题
【发布时间】:2017-07-13 00:02:55
【问题描述】:

我有一个 RedHat 主节点和一个 Windows 从节点。 Jenkins (v2.46) 安装在同一个 RedHat 盒子上。 我在 Windows 从属节点上运行作业时遇到异常。在主节点上执行的作业没有问题地执行。值得一提的是,这只是在升级(以及其他)这些插件之后才开始:

  • v2.1.13 的凭据插件
  • git 客户端插件到 v2.4.4
  • git 插件到 v3.3.0
  • ssh 凭证插件到 v1.13
  • ssh 从属插件到 v1.17

我已经阅读了许多类似的问题,并尝试并检查了大多数建议的解决方案,但似乎没有一个能解决我的问题。 我尝试过的解决方案涉及检查 Windows 框上的凭据,因此我已经验证了这些: 我已经在 Windows 机器上检查过,我在 jenkins 用户帐户的用户主目录中有包含正确文件(和内容)的 .ssh 文件夹。 如果我在 Windows 机器上手动克隆存储库(即在 Git Bash 中使用 git clone 命令),它不会要求我提供 jenkins 凭据,它会成功克隆存储库。这两个都让我相信本地凭据不是问题。

Fetching upstream changes from git@BBB.git
 > git --version # timeout=10
using GIT_SSH to set credentials Jenkins SSH for cloning from git repositories.
 > git fetch --tags --progress git@BBB.git +refs/heads/*:refs/remotes/origin/* --prune --depth=1
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@BBB.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:809)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1076)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1107)
    at hudson.scm.SCM.checkout(SCM.java:496)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
    at hudson.model.Run.execute(Run.java:1728)
    at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:405)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@BBB.git +refs/heads/*:refs/remotes/origin/* --prune --depth=1" returned status code 128:

我怀疑我错过了 Jenkins 中的配置,但找不到什么。任何帮助或指点将不胜感激。

我所做的另一个观察是,詹金斯在处理带有空格的工作区时可能会遇到问题。因为如果我将构建从例如“First Run”重命名为“First_Run”,那么它在 Windows 节点上执行得很好。

【问题讨论】:

  • 我认为如果您使用git@...,您将使用 ssh 密钥。如果你想使用凭证助手,你必须使用 https://... 并且你必须检查本地设置不会覆盖 coorect 全局设置。
  • 是的,我正在使用 SSH,但不想使用凭证助手

标签: git jenkins ssh


【解决方案1】:

今天,我遇到了这个问题。 在我的研究之后,我如何设法解决这个问题是通过在 Windows 从属服务器上重新安装 git 而不选中“启用 Git 凭据管理器”选项的复选框。

希望这会有所帮助。 :)

【讨论】:

  • 这并没有解决我的错误:克隆远程仓库'origin'时出错
【解决方案2】:

尝试在“全局工具配置”中设置 git.exe 的路径

{jenkins_url}/configureTools/

【讨论】:

  • 这不是主节点上 git.exe 的路径吗?我不确定这是否会解决从节点上 git.exe 的路径与主节点不同的问题。
猜你喜欢
  • 2011-12-27
  • 1970-01-01
  • 1970-01-01
  • 2018-11-15
  • 2011-11-02
  • 1970-01-01
  • 1970-01-01
  • 2020-08-22
  • 2018-09-11
相关资源
最近更新 更多