簡體   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