繁体   English   中英

无法在 Jenkins 中克隆 Git 存储库,请求超时

[英]Unable to clone Git repository in Jenkins, request timed out

不知道为什么 Jenkins 无法从 Bitbucket 服务器获取 repo。 我在 Jenkins slave 中运行 Git for Windows。 使用最新的 Jenkins 社区 LTS 版本,即 2.107.2。 请参阅下面的错误日志 -

23:39:06 ERROR: Timeout after 10 minutes
23:39:07 ERROR: Error fetching remote repo 'origin'
23:39:07 hudson.plugins.git.GitException: Failed to fetch from https://xxx/stash/xyz.git
23:39:07    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:862)
23:39:07    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1129)
23:39:07    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1160)
23:39:07    at hudson.scm.SCM.checkout(SCM.java:504)
23:39:07    at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
23:39:07    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
23:39:07    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
23:39:07    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
23:39:07    at hudson.model.Run.execute(Run.java:1727)
23:39:07    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
23:39:07    at hudson.model.ResourceController.execute(ResourceController.java:97)
23:39:07    at hudson.model.Executor.run(Executor.java:429)
23:39:07 Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\bin\git.exe fetch --tags --progress https://xxx/stash/xyz.git +refs/heads/*:refs/remotes/origin/*" returned status code -1:

确保在使用主从配置并尝试使用git clone或其他方法时正确配置了(主和从属)。

  • 在master上:应该安装git
  • 在从属服务器上:git应该在主节点配置中安装和配置:
    管理Jenkins>管理节点> Windows节点名称>配置
    例如:

在此处输入图片说明

问题是Bitbucket中有大量开放分支(约170个)。 由于git操作超时。 删除过时的分支(〜60)后,它开始工作。

只是将我的 2 美分添加到已经解决的答案中,以防有人遇到同样的问题。 在我的情况下,打开的分支不是太多,而是存储库的大小。 我在以.<\/code>开头的隐藏文件夹中有一些隐藏文件.<\/code> -> .terraform<\/code>是不必要的提交。 这些文件加起来大约40MB<\/code> 。 在删除这些文件并将.terraform<\/code>添加到.gitignore<\/code> Jenkins CI 管道之后,可以.terraform<\/code>地克隆 repo。

"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM