为什么Jenkins从git中获取失败,而命令行不是? [英] Why is Jenkins failing when fetching from git, while the command line isn't?

查看:3907
本文介绍了为什么Jenkins从git中获取失败,而命令行不是?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的所有Jenkins构建都在 git fetch 行失败。 git fetch --tags --progress git@bitbucket.org:ethenwilson / whentoact.git

 由用户匿名
开始在工作区中建立/Users/ethen/.jenkins/workspace/Build NikNik
> git rev-parse --is-inside-work-tree
从远程Git存储库获取更改
> git config remote.origin.url git@bitbucket.org:ethenwilson / whentoact.git
从git@bitbucket.org获取上行变化:ethenwilson / whentoact.git
> git --version
使用GIT_SSH设置证书NikNik BitBucket SSH密钥
> git fetch --tags --progress git@bitbucket.org:ethenwilson / whentoact.git + refs / heads / *:refs / remotes / origin / *
致命错误:无法从git@bitbucket.org获取:ethenwilson /whentoact.git
hudson.plugins.git.GitException:无法从git@bitbucket.org获取:在hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java ethenwilson / whentoact.git
: 622)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:854)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:879)
at hudson .model.AbstractProject.checkout(AbstractProject.java:1252)
at hudson.model.AbstractBuild $ AbstractBuildExecution.defaultCheckout(AbstractBuild.java:624)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java :在hudson.model.Run.execute 86)
在hudson.model.AbstractBuild $ AbstractBuildExecution.run(AbstractBuild.java:530)
(Run.java:1732)
。在哈德森。 model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceControll er.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:234)
引起:hudson.plugins.git.GitException:命令git fetch - 标签--progress git@bitbucket.org:ethenwilson / whentoact.git + refs / heads / *:refs / remotes / origin / *返回状态码128:
stdout:
stderr:remote:计数对象:2682,完成[K
remote:压缩对象:0%(1/1399)[K
remote:压缩对象:1%(14/1399)[K
remote:压缩对象:2%(28/1399)[K
remote:压缩对象:3%(42/1399)[K
remote:压缩对象:4%(56/1399)[K
remote:压缩对象:5%(70/1399)[K
remote:压缩对象:6%(84/1399)[K
remote:压缩对象:7%(98/1399) [K
remote:压缩对象:8%(112/1399)[K
remote:压缩对象:9%(126/1399)[K
remote:压缩对象:10%( [K
remote:压缩对象:11%(154/1399 )[K
remote:压缩对象:12%(168/1399)[K
remote:压缩对象:13%(182/1399)[K
remote:压缩对象:14% (196/1399)[K
remote:压缩对象:15%(210/1399)[K
remote:压缩对象:16%(224/1399)[K
remote:Compressing对象:17%(238/1399)[K
remote:压缩对象:18%(252/1399)[K
remote:压缩对象:19%(266/1399)[K
远程:压缩对象:20%(280/1399)[K
远程:压缩对象:21%(294/1399)[K
远程:压缩对象:22%(308/1399)[ K
remote:压缩对象:23%(322/1399)[K
remote:压缩对象:24%(336/1399)[K
remote:压缩对象:25%(350 [K
remote:压缩对象:26%(364/1399)[K
remote:压缩对象:27%(378/1399)[K
remote:压缩对象: 28%(392/1399)[K
遥控:压缩对象:29%(406/1399)[K
远程:压缩对象:30%(420/1399)[K
远程:压缩对象:31%(434/1399)[K
远程:压缩对象:32%(448/1399)[ K
remote:压缩对象:33%(462/1399)[K
remote:压缩对象:34%(476/1399)[K
remote:压缩对象:35%(490 [K
remote:压缩对象:36%(504/1399)[K
remote:压缩对象:37%(518/1399)[K
remote:压缩对象: 38%(532/1399)[K
遥控:压缩对象:39%(546/1399)[K
遥控:压缩对象:40%(560/1399)[K
遥控:压缩对象:41%(574/1399)[K
remote:压缩对象:42%(588/1399)[K
remote:压缩对象:43%(602/1399)[K
remote:压缩对象:44%(616/1399)[K
remote:压缩对象:45%(630/1399)[K
remote:压缩对象:46%(644/1399 )[K
remote:压缩对象:47%(658/1399)[K
remote:压缩对象:48%(672/1399)[K
remote:压缩对象:49%(686/1399)[K
remote:压缩对象:50%(700/1399)[K
remote:压缩对象:51%(714/1399)[K
remote:压缩对象:52%(728/1399)[K
remote:压缩对象:53%(742/1399) [K
remote:压缩对象:54%(756/1399)[K
remote:压缩对象:55%(770/1399)[K
remote:压缩对象:56%( 784/1399)[K
remote:压缩对象:57%(798/1399)[K
remote:压缩对象:58%(812/1399)[K
remote:压缩对象:59%(826/1399)[K
遥控:压缩对象:60%(840/1399)[K
遥控:压缩对象:61%(854/1399)[K
远程:压缩对象:62%(868/1399)[K
远程:压缩对象:63%(882/1399)[K
远程:压缩对象:64%(896/1399)[K
remote:压缩对象:65%(910/1399)[K
remote:Compressin g对象:66%(924/1399)[K
remote:压缩对象:67%(938/1399)[K
remote:压缩对象:68%(952/1399)[K
remote:压缩对象:69%(966/1399)[K
remote:压缩对象:70%(980/1399)[K
remote:压缩对象:71%(994/1399) [K
remote:压缩对象:72%(1008/1399)[K
remote:压缩对象:73%(1022/1399)[K
remote:压缩对象:74%( 1036/1399)[K
remote:压缩对象:75%(1050/1399)[K
remote:压缩对象:76%(1064/1399)[K
remote:压缩对象:77%(1078/1399)[K
遥控:压缩对象:78%(1092/1399)[K
遥控:压缩对象:79%(1106/1399)[K
远程:压缩对象:80%(1120/1399)[K
远程:压缩对象:81%(1134/1399)[K
远程:压缩对象:82%(1148/1399)[K
remote:压缩对象:83%(1162/1399)[K
remote:Compress 84%(1176/1399)[K
遥控:压缩对象:85%(1190/1399)[K
遥控:压缩对象:86%(1204/1399)[K
remote:压缩对象:87%(1218/1399)[K
remote:压缩对象:88%(1232/1399)[K
remote:压缩对象:89%(1246/1399) [K
remote:压缩对象:90%(1260/1399)[K
remote:压缩对象:91%(1274/1399)[K
remote:压缩对象:92%( [K
remote:压缩对象:93%(1302/1399)[K
remote:压缩对象:94%(1316/1399)[K
remote:压缩对象:95%(1330/1399)[K
遥控:压缩对象:96%(1344/1399)[K
遥控:压缩对象:97%(1358/1399)[K
远程:压缩对象:98%(1372/1399)[K
远程:压缩对象:99%(1386/1399)[K
远程:压缩对象:99%(1398/1399)[K
remote:压缩对象:100%(1399/1399)[K
remote:压缩对象:100%(1399/1399),完成[K
接收对象:0%(1/2682)
接收对象:1%(27/2682)
接收对象: 2%(54/2682)
收款对象:3%(81/2682)
收款对象:4%(108/2682)
收款对象:5%(135/2682)
接收对象:6%(161/2682)
接收对象:7%(188/2682)
接收对象:8%(215/2682)
接收对象:9% (242/2682)
收款对象:10%(269/2682)
收款对象:11%(296/2682)
收款对象:12%(322/2682)
接收对象:13%(349/2682)
接收对象:14%(376/2682)
接收对象:15%(403/2682)
接收对象:16%(430 / 2682)
接收对象:17%(456/2682)
接收对象:18%(483/2682)
接收对象:19%(510/2682)
接收对象:20%(537/2682)
收款对象:21%(564/2682)
Receivi ng接收对象:22%(591/2682)
接收对象:23%(617/2682)
接收对象:24%(644/2682)
接收对象:25%(671 / 2682)
接收对象:26%(698/2682)
接收对象:27%(725/2682)
接收对象:28%(751/2682)
接收对象:29%(778/2682)
收款对象:30%(805/2682)
收款对象:31%(832/2682)
收款对象:32%(859/2682)
接收对象:33%(886/2682)
接收对象:34%(912/2682)
接收对象:35%(939/2682)
接收对象:36接收对象:37%(993/2682)
接收对象:38%(1020/2682)
接收对象:39%(1046/2682)
接收对象:40%(1073/2682)
接收对象:41%(1100/2682)
接收对象:42%(1127/2682)
接收对象:43%( 1154/2682)
接收对象:44%(1181/2682)
接收o bject:45%(1207/2682)
收款对象:46%(1234/2682)
收款对象:47%(1261/2682)
收款对象:48%(1288/2682 )
接收对象:49%(1315/2682),428.00 KiB | 846.00 KiB / s
收货对象:50%(1341/2682),428.00 KiB | 846.00 KiB / s
收货对象:51%(1368/2682),428.00 KiB | 846.00 KiB / s
收货对象:52%(1395/2682),428.00 KiB | 846.00 KiB / s
收货对象:53%(1422/2682),428.00 KiB | 846.00 KiB / s
收货对象:54%(1449/2682),428.00 KiB | 846.00 KiB / s
收款对象:55%(1476/2682),428.00 KiB | 846.00 KiB / s
收货对象:56%(1502/2682),428.00 KiB | 846.00 KiB / s
收货对象:57%(1529/2682),428.00 KiB | 846.00 KiB / s
收货对象:58%(1556/2682),428.00 KiB | 846.00 KiB / s
收货对象:59%(1583/2682),428.00 KiB | 846.00 KiB / s
收货对象:60%(1610/2682),428.00 KiB | 846.00 KiB / s
收货对象:61%(1637/2682),428.00 KiB | 846.00 KiB / s
收货对象:62%(1663/2682),428.00 KiB | 846.00 KiB / s
收货对象:63%(1690/2682),428.00 KiB | 846.00 KiB / s
收货对象:64%(1717/2682),428.00 KiB | 846.00 KiB / s
收货对象:65%(1744/2682),428.00 KiB | 846.00 KiB / s
收货对象:66%(1771/2682),428.00 KiB | 846.00 KiB / s
收货对象:66%(1792/2682),1.39 MiB | 1.35 MiB / s
接收对象:67%(1797/2682),1.39 MiB | 1.35 MiB / s
接收对象:68%(1824/2682),1.39 MiB | 1.35 MiB / s
接收对象:69%(1851/2682),2.23 MiB | 1.45 MiB / s
接收对象:70%(1878/2682),2.23 MiB | 1.45 MiB / s
接收对象:71%(1905/2682),2.23 MiB | 1.45 MiB / s
接收对象:72%(1932/2682),2.23 MiB | 1.45 MiB / s
接收对象:73%(1958/2682),2.23 MiB | 1.45 MiB / s
接收对象:74%(1985/2682),2.23 MiB | 1.45 MiB / s
接收对象:75%(2012/2682),2.23 MiB | 1.45 MiB / s
接收对象:76%(2039/2682),2.23 MiB | 1.45 MiB / s
接收对象:76%(2042/2682),2.23 MiB | 1.45 MiB / s
接收对象:77%(2066/2682),3.11 MiB | 1.52 MiB / s
接收对象:78%(2092/2682),4.07 MiB | 1.59 MiB / s
输入中的MAC损坏。
断开连接:数据包损坏
致命:远程终端意外挂起
致命:早期EOF
致命:索引包装失败

在org.jenkinsci .plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1325)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1186)
at org.jenkinsci.plugins.gitclient .CliGitAPIImpl.access $ 200(CliGitAPIImpl.java:87)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl $ 1.execute(CliGitAPIImpl.java:257)
at hudson.plugins.git.GitSCM.fetchFrom (GitSCM.java:620)
... 10 more

当我运行 git fetch --tags --progress git@bitbucket.org:ethenwilson / whentoact.git 在命令行中,它工作正常,这意味着我的SSH密钥必须正常工作。 p>

我通过SSH验证与Jenkins连接到BitBucket。詹金斯从它所在的文件中获取密钥(默认密钥),所以我知道詹金斯使用与我在命令行运行时相同的密钥。



我正在为Jenkins使用BitBucket和Git插件的最新版本。我的Mac上安装的Git版本为 1.8.5.2(Apple Git-48)



我的jenkins开始命令是 nohup java -jar〜/ jenkins.war --httpPort = 8081 --ajp13Port = 8010> /tmp/jenkins.log 2>& 1&



发生了什么问题?

编辑:我错了,当我这样做时,我不小心碰到了一个让SSH密钥出错的选项。现在,使用@ borrrden的建议,它仍然会给出同样的错误。 **编辑:由于@borrrden建议,我将我的开始命令更改为 nohup java -Dorg.jenkinsci.plugins.gitclient.Git.useCLI = true -jar〜/ Downloads / jenkins.war --httpPort = 8081 --ajp13Port = 8010> /tmp/jenkins.log 2>& 1& ,现在我得到一个不同的崩溃:

 由用户anonymous开始
在工作区中建立/Users/ethen/.jenkins/workspace/Build NikNik
> git rev-parse --is-inside-work-tree
从远程Git存储库获取更改
> git config remote.origin.url git@bitbucket.org:ethenwilson / whentoact.git
从git@bitbucket.org获取上行变化:ethenwilson / whentoact.git
> git --version
使用GIT_SSH设置证书NikNik BitBucket SSH密钥
> git fetch --tags --progress git@bitbucket.org:ethenwilson / whentoact.git + refs / heads / *:refs / remotes / origin / *
致命错误:无法从git@bitbucket.org获取:ethenwilson /whentoact.git
hudson.plugins.git.GitException:无法从git@bitbucket.org获取:在hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java ethenwilson / whentoact.git
: 622)
在hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:854)
在hudson.plugins.git.GitSCM.checkout(GitSCM.java:879)
公司Hudson .model.AbstractProject.checkout(AbstractProject.java:1252)
at hudson.model.AbstractBuild $ AbstractBuildExecution.defaultCheckout(AbstractBuild.java:624)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java :在hudson.model.Run.execute 86)
在hudson.model.AbstractBuild $ AbstractBuildExecution.run(AbstractBuild.java:530)
(Run.java:1732)
。在哈德森。 model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceControll er.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:234)
引起:hudson.plugins.git.GitException:命令git fetch - 标签--progress git@bitbucket.org:ethenwilson / whentoact.git + refs / heads / *:refs / remotes / origin / *返回状态码128:
stdout:
stderr:Permission denied公钥)。
致命:无法从远程存储库读取。

请确保您拥有正确的访问权限
并存在存储库。

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1406)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1194)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access $ 200(CliGitAPIImpl.java:87)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl $ 1.execute(CliGitAPIImpl.java:265)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:620)
... 10 more


解决方案

对我来说,这是git-client插件的10分钟默认超时。
通过在作业上设置高级克隆行为并加快超时来解决。
在此获得的知识: https://issues.jenkins-ci.org/browse/JENKINS-20445?focusedCommentId=195638&page=com.atlassian.jira.plugin.system.issuetabpanels:comment -tabpanel#comment-195638


All of my Jenkins builds are failing at the git fetch line.

It's failing at git fetch --tags --progress git@bitbucket.org:ethenwilson/whentoact.git

Started by user anonymous
Building in workspace /Users/ethen/.jenkins/workspace/Build NikNik
 > git rev-parse --is-inside-work-tree
Fetching changes from the remote Git repository
 > git config remote.origin.url git@bitbucket.org:ethenwilson/whentoact.git
Fetching upstream changes from git@bitbucket.org:ethenwilson/whentoact.git
 > git --version
using GIT_SSH to set credentials NikNik BitBucket SSH Key
 > git fetch --tags --progress git@bitbucket.org:ethenwilson/whentoact.git +refs/heads/*:refs/remotes/origin/*
FATAL: Failed to fetch from git@bitbucket.org:ethenwilson/whentoact.git
hudson.plugins.git.GitException: Failed to fetch from git@bitbucket.org:ethenwilson/whentoact.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:622)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:854)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:879)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1252)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:624)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:530)
    at hudson.model.Run.execute(Run.java:1732)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:234)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@bitbucket.org:ethenwilson/whentoact.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: remote: Counting objects: 2682, done.[K
remote: Compressing objects:   0% (1/1399)   [K
remote: Compressing objects:   1% (14/1399)   [K
remote: Compressing objects:   2% (28/1399)   [K
remote: Compressing objects:   3% (42/1399)   [K
remote: Compressing objects:   4% (56/1399)   [K
remote: Compressing objects:   5% (70/1399)   [K
remote: Compressing objects:   6% (84/1399)   [K
remote: Compressing objects:   7% (98/1399)   [K
remote: Compressing objects:   8% (112/1399)   [K
remote: Compressing objects:   9% (126/1399)   [K
remote: Compressing objects:  10% (140/1399)   [K
remote: Compressing objects:  11% (154/1399)   [K
remote: Compressing objects:  12% (168/1399)   [K
remote: Compressing objects:  13% (182/1399)   [K
remote: Compressing objects:  14% (196/1399)   [K
remote: Compressing objects:  15% (210/1399)   [K
remote: Compressing objects:  16% (224/1399)   [K
remote: Compressing objects:  17% (238/1399)   [K
remote: Compressing objects:  18% (252/1399)   [K
remote: Compressing objects:  19% (266/1399)   [K
remote: Compressing objects:  20% (280/1399)   [K
remote: Compressing objects:  21% (294/1399)   [K
remote: Compressing objects:  22% (308/1399)   [K
remote: Compressing objects:  23% (322/1399)   [K
remote: Compressing objects:  24% (336/1399)   [K
remote: Compressing objects:  25% (350/1399)   [K
remote: Compressing objects:  26% (364/1399)   [K
remote: Compressing objects:  27% (378/1399)   [K
remote: Compressing objects:  28% (392/1399)   [K
remote: Compressing objects:  29% (406/1399)   [K
remote: Compressing objects:  30% (420/1399)   [K
remote: Compressing objects:  31% (434/1399)   [K
remote: Compressing objects:  32% (448/1399)   [K
remote: Compressing objects:  33% (462/1399)   [K
remote: Compressing objects:  34% (476/1399)   [K
remote: Compressing objects:  35% (490/1399)   [K
remote: Compressing objects:  36% (504/1399)   [K
remote: Compressing objects:  37% (518/1399)   [K
remote: Compressing objects:  38% (532/1399)   [K
remote: Compressing objects:  39% (546/1399)   [K
remote: Compressing objects:  40% (560/1399)   [K
remote: Compressing objects:  41% (574/1399)   [K
remote: Compressing objects:  42% (588/1399)   [K
remote: Compressing objects:  43% (602/1399)   [K
remote: Compressing objects:  44% (616/1399)   [K
remote: Compressing objects:  45% (630/1399)   [K
remote: Compressing objects:  46% (644/1399)   [K
remote: Compressing objects:  47% (658/1399)   [K
remote: Compressing objects:  48% (672/1399)   [K
remote: Compressing objects:  49% (686/1399)   [K
remote: Compressing objects:  50% (700/1399)   [K
remote: Compressing objects:  51% (714/1399)   [K
remote: Compressing objects:  52% (728/1399)   [K
remote: Compressing objects:  53% (742/1399)   [K
remote: Compressing objects:  54% (756/1399)   [K
remote: Compressing objects:  55% (770/1399)   [K
remote: Compressing objects:  56% (784/1399)   [K
remote: Compressing objects:  57% (798/1399)   [K
remote: Compressing objects:  58% (812/1399)   [K
remote: Compressing objects:  59% (826/1399)   [K
remote: Compressing objects:  60% (840/1399)   [K
remote: Compressing objects:  61% (854/1399)   [K
remote: Compressing objects:  62% (868/1399)   [K
remote: Compressing objects:  63% (882/1399)   [K
remote: Compressing objects:  64% (896/1399)   [K
remote: Compressing objects:  65% (910/1399)   [K
remote: Compressing objects:  66% (924/1399)   [K
remote: Compressing objects:  67% (938/1399)   [K
remote: Compressing objects:  68% (952/1399)   [K
remote: Compressing objects:  69% (966/1399)   [K
remote: Compressing objects:  70% (980/1399)   [K
remote: Compressing objects:  71% (994/1399)   [K
remote: Compressing objects:  72% (1008/1399)   [K
remote: Compressing objects:  73% (1022/1399)   [K
remote: Compressing objects:  74% (1036/1399)   [K
remote: Compressing objects:  75% (1050/1399)   [K
remote: Compressing objects:  76% (1064/1399)   [K
remote: Compressing objects:  77% (1078/1399)   [K
remote: Compressing objects:  78% (1092/1399)   [K
remote: Compressing objects:  79% (1106/1399)   [K
remote: Compressing objects:  80% (1120/1399)   [K
remote: Compressing objects:  81% (1134/1399)   [K
remote: Compressing objects:  82% (1148/1399)   [K
remote: Compressing objects:  83% (1162/1399)   [K
remote: Compressing objects:  84% (1176/1399)   [K
remote: Compressing objects:  85% (1190/1399)   [K
remote: Compressing objects:  86% (1204/1399)   [K
remote: Compressing objects:  87% (1218/1399)   [K
remote: Compressing objects:  88% (1232/1399)   [K
remote: Compressing objects:  89% (1246/1399)   [K
remote: Compressing objects:  90% (1260/1399)   [K
remote: Compressing objects:  91% (1274/1399)   [K
remote: Compressing objects:  92% (1288/1399)   [K
remote: Compressing objects:  93% (1302/1399)   [K
remote: Compressing objects:  94% (1316/1399)   [K
remote: Compressing objects:  95% (1330/1399)   [K
remote: Compressing objects:  96% (1344/1399)   [K
remote: Compressing objects:  97% (1358/1399)   [K
remote: Compressing objects:  98% (1372/1399)   [K
remote: Compressing objects:  99% (1386/1399)   [K
remote: Compressing objects:  99% (1398/1399)   [K
remote: Compressing objects: 100% (1399/1399)   [K
remote: Compressing objects: 100% (1399/1399), done.[K
Receiving objects:   0% (1/2682)   
Receiving objects:   1% (27/2682)   
Receiving objects:   2% (54/2682)   
Receiving objects:   3% (81/2682)   
Receiving objects:   4% (108/2682)   
Receiving objects:   5% (135/2682)   
Receiving objects:   6% (161/2682)   
Receiving objects:   7% (188/2682)   
Receiving objects:   8% (215/2682)   
Receiving objects:   9% (242/2682)   
Receiving objects:  10% (269/2682)   
Receiving objects:  11% (296/2682)   
Receiving objects:  12% (322/2682)   
Receiving objects:  13% (349/2682)   
Receiving objects:  14% (376/2682)   
Receiving objects:  15% (403/2682)   
Receiving objects:  16% (430/2682)   
Receiving objects:  17% (456/2682)   
Receiving objects:  18% (483/2682)   
Receiving objects:  19% (510/2682)   
Receiving objects:  20% (537/2682)   
Receiving objects:  21% (564/2682)   
Receiving objects:  22% (591/2682)   
Receiving objects:  23% (617/2682)   
Receiving objects:  24% (644/2682)   
Receiving objects:  25% (671/2682)   
Receiving objects:  26% (698/2682)   
Receiving objects:  27% (725/2682)   
Receiving objects:  28% (751/2682)   
Receiving objects:  29% (778/2682)   
Receiving objects:  30% (805/2682)   
Receiving objects:  31% (832/2682)   
Receiving objects:  32% (859/2682)   
Receiving objects:  33% (886/2682)   
Receiving objects:  34% (912/2682)   
Receiving objects:  35% (939/2682)   
Receiving objects:  36% (966/2682)   
Receiving objects:  37% (993/2682)   
Receiving objects:  38% (1020/2682)   
Receiving objects:  39% (1046/2682)   
Receiving objects:  40% (1073/2682)   
Receiving objects:  41% (1100/2682)   
Receiving objects:  42% (1127/2682)   
Receiving objects:  43% (1154/2682)   
Receiving objects:  44% (1181/2682)   
Receiving objects:  45% (1207/2682)   
Receiving objects:  46% (1234/2682)   
Receiving objects:  47% (1261/2682)   
Receiving objects:  48% (1288/2682)   
Receiving objects:  49% (1315/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  50% (1341/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  51% (1368/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  52% (1395/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  53% (1422/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  54% (1449/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  55% (1476/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  56% (1502/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  57% (1529/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  58% (1556/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  59% (1583/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  60% (1610/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  61% (1637/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  62% (1663/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  63% (1690/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  64% (1717/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  65% (1744/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  66% (1771/2682), 428.00 KiB | 846.00 KiB/s   
Receiving objects:  66% (1792/2682), 1.39 MiB | 1.35 MiB/s   
Receiving objects:  67% (1797/2682), 1.39 MiB | 1.35 MiB/s   
Receiving objects:  68% (1824/2682), 1.39 MiB | 1.35 MiB/s   
Receiving objects:  69% (1851/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  70% (1878/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  71% (1905/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  72% (1932/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  73% (1958/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  74% (1985/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  75% (2012/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  76% (2039/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  76% (2042/2682), 2.23 MiB | 1.45 MiB/s   
Receiving objects:  77% (2066/2682), 3.11 MiB | 1.52 MiB/s   
Receiving objects:  78% (2092/2682), 4.07 MiB | 1.59 MiB/s   
Corrupted MAC on input.
Disconnecting: Packet corrupt
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1325)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1186)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(CliGitAPIImpl.java:87)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:257)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:620)
    ... 10 more

When I run git fetch --tags --progress git@bitbucket.org:ethenwilson/whentoact.git from the command line, it works fine, which means my SSH keys must be working.

I'm connecting to BitBucket with Jenkins with SSH verification. Jenkins gets the key from the file it's located (the default one), so I know that Jenkins is using the same key as I am when I run from the command line.

I'm using the latest build of the BitBucket and Git plugins for Jenkins. My installed Git on my Mac is version 1.8.5.2 (Apple Git-48).

My jenkins start command is nohup java -jar ~/jenkins.war --httpPort=8081 --ajp13Port=8010 > /tmp/jenkins.log 2>&1 &.

What's going wrong?

EDIT: I was wrong, I had accidentally hit an option to have the SSH Key be in the wrong place when I did that. Now, using @borrrden's suggestion, it still gives the same error. **EDIT: As @borrrden suggested, I changed my start command to nohup java -Dorg.jenkinsci.plugins.gitclient.Git.useCLI=true -jar ~/Downloads/jenkins.war --httpPort=8081 --ajp13Port=8010 > /tmp/jenkins.log 2>&1 &, and now I get a different crash:

Started by user anonymous
Building in workspace /Users/ethen/.jenkins/workspace/Build NikNik
 > git rev-parse --is-inside-work-tree
Fetching changes from the remote Git repository
 > git config remote.origin.url git@bitbucket.org:ethenwilson/whentoact.git
Fetching upstream changes from git@bitbucket.org:ethenwilson/whentoact.git
 > git --version
using GIT_SSH to set credentials NikNik BitBucket SSH Key
 > git fetch --tags --progress git@bitbucket.org:ethenwilson/whentoact.git +refs/heads/*:refs/remotes/origin/*
FATAL: Failed to fetch from git@bitbucket.org:ethenwilson/whentoact.git
hudson.plugins.git.GitException: Failed to fetch from git@bitbucket.org:ethenwilson/whentoact.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:622)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:854)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:879)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1252)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:624)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:530)
    at hudson.model.Run.execute(Run.java:1732)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:234)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@bitbucket.org:ethenwilson/whentoact.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1406)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1194)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(CliGitAPIImpl.java:87)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:265)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:620)
    ... 10 more

解决方案

For me, this was hitting the 10 minute default timeout for the git-client plugin. Solved by setting an advanced clone behaviour on the job and upping the timeout. Knowledge gained here: https://issues.jenkins-ci.org/browse/JENKINS-20445?focusedCommentId=195638&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-195638

这篇关于为什么Jenkins从git中获取失败,而命令行不是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆