Description
Jenkins 拉取git 仓库代码报错:ERROR: Error fetching remote repo 'origin'
-
相关报错
+refs/pull/*:refs/remotes/origin/pr/* --depth=1 # timeout=60 22:29:14 ERROR: Error fetching remote repo 'origin' 22:29:14 hudson.plugins.git.GitException: Failed to fetch from <https://github.com/xxxxxx/ppppp.git> 22:29:14 at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:888) 22:29:14 at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1155) 22:29:14 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186) 22:29:14 at hudson.scm.SCM.checkout(SCM.java:505) 22:29:14 at hudson.model.AbstractProject.checkout(AbstractProject.java:1206) 22:29:14 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:637) 22:29:14 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) 22:29:14 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:509) 22:29:14 at hudson.model.Run.execute(Run.java:1907) 22:29:14 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 22:29:14 at hudson.model.ResourceController.execute(ResourceController.java:97) 22:29:14 at hudson.model.Executor.run(Executor.java:429) 22:29:14 Caused by: hudson.plugins.git.GitException: Command "git fetch --no-tags --progress <https://github.com/xxxxxx/pppppp.git> +refs/pull/*:refs/remotes/origin/pr/* --depth=1" returned status code 128: 22:29:14 stdout: 22:29:14 stderr: fatal: unable to get credential storage lock: File exists 22:29:14 fatal: Unable to create '/opt/jenkins/workspace/pppppp-PR-Check/.git/shallow.lock': File exists. 22:29:14
Root Cause
对应的报错当中已经有所提示了,提示 shallow.lock 文件已经存在
fatal: Unable to create '/opt/jenkins/workspace/ppppp-PR-Check/.git/shallow.lock': File exists.
Solutions
找到 shallow.lock 文件进行删除即可,并重新拉取最新代码
Related
对于 shallow.lock 的相关解释
This is because when the shallow lock is committed, the stat information
of the shallow file is not cleared. Ensure that this information is
always cleared whenever the shallow lock is committed by introducing a
new API that hides the shallow lock behind a custom struct.

本文介绍了在使用Jenkins从Git仓库拉取代码时遇到的ERROR: Error fetching remote repo 'origin'错误。错误原因是shallow.lock文件存在,解决方案是删除该文件并重新拉取代码。
4154

被折叠的 条评论
为什么被折叠?



