我的所有Jenkins版本都在git fetch
行失败。
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
当我从命令行运行git fetch --tags --progress git@bitbucket.org:ethenwilson/whentoact.git
时,它运行正常,这意味着我的SSH密钥必须正常工作。
我通过SSH验证与Jenkins连接到BitBucket。 Jenkins从它所在的文件(默认文件)中获取密钥,因此我知道Jenkins使用与从命令行运行时相同的密钥。
我正在为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 Key出错的选项。现在,使用@ borrrden的建议,它仍然会给出相同的错误。 **编辑: 正如@borrrden建议的那样,我将我的启动命令更改为 nohup java -Dorg.jenkinsci.plugins.gitclient.Git.useCLI=true -jar ~/Downloads/jenkins.war --httpPort=8081 --ajp13Port=8010 > /tmp/jenkins.log 2>&1 &
,现在我遇到了不同的崩溃:
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
答案 0 :(得分:3)
我也有这个问题,只能通过我们的主Jenkins服务器上的删除有问题的存储库来解决它。
我认为问题是在一些构建中存在连接错误(如@gbjbaanb所述)(我们的Bitbucket崩溃)。这使得master上的工作空间处于损坏状态,并且由于Jenkins尝试在可能的地方使用缓存工作空间,这导致每个后续构建也失败。
答案 1 :(得分:3)
2)转到“源代码管理”部分
3)其他行为>添加
4)选择“擦除存储库并强制克隆”
这将仅删除并重新克隆适合您工作的工作区。如果你想在删除之前确认,那么我建议通过batch / bash命令构建步骤回显$ WORKSPACE变量。
此外,这会使构建速度变得更慢,因此我建议在构建一次后将其删除。
答案 2 :(得分:2)
看起来像网络错误:
接收物品:78%(2092/2682),4.07 MiB | 1.59 MiB / s
输入损坏的MAC。
断开连接:数据包损坏
致命:远程端意外挂断
致命:早期EOF
致命:索引包失败
表明该网络在78%的时间内突破了。
答案 3 :(得分:2)
对我来说,这是git-client插件的10分钟默认超时。 通过在作业上设置高级克隆行为并提高超时来解决此问题。 从这里获得的知识:https://issues.jenkins-ci.org/browse/JENKINS-20445?focusedCommentId=195638&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-195638
答案 4 :(得分:1)
此问题可能是由提取时的超时检查引起的。您可以按照以下建议增加它。
在Git插件部分下的作业配置页面中,有一个下拉列表" Add"。在该下拉列表中,有一个选择"高级克隆行为"。添加高级克隆行为时,您将看到"超时(以分钟为单位)的字段,用于克隆和获取操作"。
答案 5 :(得分:0)
我通过连接到BitBucket时将'ssh'切换为'https'解决了类似的问题。记住在bitbucket UI上,单击“克隆”时,有ssh / https的下拉选项。使用https后,git pull可以工作。
答案 6 :(得分:0)
我在Windows服务器中遇到了类似的超时问题,在那里我的远程GIT存储库很大,克隆起来很慢。
我已根据此post的建议进行了以下操作以解决超时问题。
手动克隆存储库(不一定是git clone --mirror git@github.com:my-user/my-repository.git
,因为在我偶然发现第二条建议之前,我已经将其克隆到了一个文件夹中。无论如何,如果您是新开始的读者,都可以使用{{1 }} 选项)。这将作为我的参考资料库。
在詹金斯工作中配置mirror
,如下所示
存储库:按常规配置
要构建的分支:按常规配置
存储库浏览器 :(自动)(默认值)
其他行为:高级克隆行为
获取标签-未选中
初始克隆上的荣誉参考-未选中
浅克隆-已检查
克隆深度浅- 1(我们不必为整个历史烦恼,只有最新的足够了)
在克隆过程中使用的参考仓库的路径-克隆整个仓库的仓库的文件夹路径(请参阅上面的步骤1 )
克隆和获取操作的超时(以分钟为单位)-在我的情况下为(如果您需要其他超时(默认为10分钟),则可以在此处提及)
答案 7 :(得分:-1)
我能够通过专门为Jenkins创建BitBucket帐户来解决问题,并为其提供管理员权限。
然后我将存储库URL设为:https://JenkinsAccountUsername:JenkinsAccountPassword@bitbucket.org/OwnerOfRepositoryUsername/ProjectName.git
。