Jenkins打包报错拉取git失败

报错信息如下:

Running as SYSTEM
Building in workspace /root/.jenkins/workspace/chem-blade-new
The recommended git tool is: NONE
using credential 4bf4becc-3d6e-4a01-96fe-6681ddddc5d3
Cloning the remote Git repository
Cloning repository [https://gitee.com/ChemCyber/chem-blade-new.git](https://gitee.com/ChemCyber/chem-blade-new.git)
 > /usr/bin/git init /root/.jenkins/workspace/chem-blade-new # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init /root/.jenkins/workspace/chem-blade-new
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:1073)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:819)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1220)
    at hudson.plugins.git.GitSCM._checkout(GitSCM.java:1310)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1277)
    at hudson.scm.SCM.checkout(SCM.java:540)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1248)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:649)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:521)
    at hudson.model.Run.execute(Run.java:1894)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
    at hudson.model.ResourceController.execute(ResourceController.java:101)
    at hudson.model.Executor.run(Executor.java:442)
Caused by: hudson.plugins.git.GitException: Error performing git command: /usr/bin/git init /root/.jenkins/workspace/chem-blade-new
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2862)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2766)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2761)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:2051)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:1071)
    ... 13 more
Caused by: java.io.IOException: Cannot run program "/usr/bin/git" (in directory "/root/.jenkins/workspace/chem-blade-new"): error=0, Failed to exec spawn helper: pid: 260119, exit value: 1
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
    at hudson.Proc$LocalProc.<init>(Proc.java:252)
    at hudson.Proc$LocalProc.<init>(Proc.java:221)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:994)
    at hudson.Launcher$ProcStarter.start(Launcher.java:506)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2839)
    ... 17 more
Caused by: java.io.IOException: error=0, Failed to exec spawn helper: pid: 260119, exit value: 1
    at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
    at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:314)
    at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:244)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
    ... 23 more
ERROR: Error cloning remote repo 'origin'
Finished: FAILURE</pre>

解决办法:更新git插件
系统管理 > 插件管理 > 可更新插件 > 搜索 git client
更新后重启即可。

Jenkins版本:Jenkins 2.332.3

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容