这是我在build now时遇到的报错,此时的这个节点是从节点,刚刚搭建完成主从节点去测试能否正常进行build。然后就遇到了这个报错

检查时节点项目配置是没有错误的。所以就是代码没有拉取成功,所以就想是不是从节点的主机上是没有安装git,导致无法拉取代码。

然后从节点安装git就能正常拉取了

Building remotely on slave1 in workspace /root/jenkins/workspace/test-slave1

The recommended git tool is: NONE

using credential aaffde15-b220-49b1-b92a-1c965b31de65

Cloning the remote Git repository

Cloning repository http://192.168.0.51/web/web.git

> git init /root/jenkins/workspace/test-slave1 # timeout=10

ERROR: Error cloning remote repo 'origin'

hudson.plugins.git.GitException: Could not init /root/jenkins/workspace/test-slave1

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:1049)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:802)

at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:158)

at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:151)

at hudson.remoting.UserRequest.perform(UserRequest.java:211)

at hudson.remoting.UserRequest.perform(UserRequest.java:54)

at hudson.remoting.Request$2.run(Request.java:376)

at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:126)

at java.lang.Thread.run(Thread.java:748)

Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from NO4/192.168.0.53:42234

at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1784)

at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)

at hudson.remoting.Channel.call(Channel.java:1000)

at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:143)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:129)

at com.sun.proxy.$Proxy83.execute(Unknown Source)

at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1225)

at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1308)

at hudson.scm.SCM.checkout(SCM.java:540)

at hudson.model.AbstractProject.checkout(AbstractProject.java:1217)

at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:647)

at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)

at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:519)

at hudson.model.Run.execute(Run.java:1897)

at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)

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: git init /root/jenkins/workspace/test-slave1

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2746)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2660)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2656)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1981)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:1047)

... 12 more

Caused by: java.io.IOException: Cannot run program "git" (in directory "/root/jenkins/workspace/test-slave1"): error=2, 没有那个文件或目录

at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)

at hudson.Proc$LocalProc.<init>(Proc.java:254)

at hudson.Proc$LocalProc.<init>(Proc.java:223)

at hudson.Launcher$LocalLauncher.launch(Launcher.java:997)

at hudson.Launcher$ProcStarter.start(Launcher.java:509)

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2727)

... 16 more

Caused by: java.io.IOException: error=2, 没有那个文件或目录

at java.lang.UNIXProcess.forkAndExec(Native Method)

at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)

at java.lang.ProcessImpl.start(ProcessImpl.java:134)

at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)

... 21 more

ERROR: Error cloning remote repo 'origin'

Finished: FAILURE

解决办法:

[root@NO4 ~]# yum install -y git #安装git

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐