简体   繁体   English

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

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

Not sure why Jenkins is unable to fetch the repo from Bitbucket server.不知道为什么 Jenkins 无法从 Bitbucket 服务器获取 repo。 I am running Git for Windows in the Jenkins slave.我在 Jenkins slave 中运行 Git for Windows。 Using latest Jenkins Community LTS edition ie 2.107.2.使用最新的 Jenkins 社区 LTS 版本,即 2.107.2。 Please see below the error log -请参阅下面的错误日志 -

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:

make sure you've configured both(master and slave) properly when using master-slave configuration and trying to use git clone or whatever. 确保在使用主从配置并尝试使用git clone或其他方法时正确配置了(主和从属)。

  • on master: git should be installed 在master上:应该安装git
  • on slave: git should be installed and configured in master nodes configuration: 在从属服务器上:git应该在主节点配置中安装和配置:
    Manage Jenkins> Manage Nodes > windowsnodename > configure 管理Jenkins>管理节点> Windows节点名称>配置
    for example: 例如:

在此处输入图片说明

The issue was large number of open branches (~170) in Bitbucket. 问题是Bitbucket中有大量开放分支(约170个)。 Due to which git operation was timed out. 由于git操作超时。 After deleting obsolete branches (~60) it started working. 删除过时的分支(〜60)后,它开始工作。

Just to add my 2 cents to the already solution answers in case someone faces the same problem.只是将我的 2 美分添加到已经解决的答案中,以防有人遇到同样的问题。 In my case was not too many branches opened but the size of the repository.在我的情况下,打开的分支不是太多,而是存储库的大小。 I had some hidden files inside a hidden folder starting with .<\/code>我在以.<\/code>开头的隐藏文件夹中有一些隐藏文件.<\/code> -> .terraform<\/code> that were unnecessary committed. -> .terraform<\/code>是不必要的提交。 The files together were about 40MB<\/code> .这些文件加起来大约40MB<\/code> 。 after deleting those files and adding the .terraform<\/code> to the .gitignore<\/code> Jenkins CI pipeline could clone the repo without problems.在删除这些文件并将.terraform<\/code>添加到.gitignore<\/code> Jenkins CI 管道之后,可以.terraform<\/code>地克隆 repo。

"

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

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