jenkins构建时git报错

  • 2018-01-28
  • 302
  • 0
  • 0

问题


今天,修改jenkins某个节点的用户信息,导致用该节点构建项目时git报错,报错信息如下:

Started by user admin
 [EnvInject] - Loading node environment variables.
 Building remotely on node-01 in workspace /data/jenkins-slave/workspace/开发-feature6/app-feature6
 > git rev-parse --is-inside-work-tree # timeout=10
 Fetching changes from the remote Git repository
 > git config remote.origin.url gitlab@gitlab.qiyun.com:service/app.git # timeout=10
 ERROR: Error fetching remote repo 'origin'
 hudson.plugins.git.GitException: Failed to fetch from gitlab@gitlab.qiyun.com:service/app.git
 at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:862)
 at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1129)
 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1160)
 at hudson.scm.SCM.checkout(SCM.java:495)
 at hudson.model.AbstractProject.checkout(AbstractProject.java:1203)
 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
 at hudson.model.Run.execute(Run.java:1727)
 at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
 at hudson.model.ResourceController.execute(ResourceController.java:97)
 at hudson.model.Executor.run(Executor.java:429)
 Caused by: hudson.plugins.git.GitException: Command "git config remote.origin.url gitlab@gitlab.qiyun.com:service/app.git" returned status code 255:
 stdout:
 stderr: error: could not lock config file .git/config: Permission denied

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1996)
 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1964)
 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1960)
 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1597)
 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1609)
 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setRemoteUrl(CliGitAPIImpl.java:1243)
 at hudson.plugins.git.GitAPI.setRemoteUrl(GitAPI.java:160)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:922)
 at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:896)
 at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:853)
 at hudson.remoting.UserRequest.perform(UserRequest.java:210)
 at hudson.remoting.UserRequest.perform(UserRequest.java:53)
 at hudson.remoting.Request$2.run(Request.java:358)
 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
 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 java.lang.Thread.run(Thread.java:748)
 Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to node-01
 at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1696)
 at hudson.remoting.UserResponse.retrieve(UserRequest.java:313)
 at hudson.remoting.Channel.call(Channel.java:909)
 at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:281)
 at com.sun.proxy.$Proxy90.setRemoteUrl(Unknown Source)
 at org.jenkinsci.plugins.gitclient.RemoteGitImpl.setRemoteUrl(RemoteGitImpl.java:295)
 at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:850)
 at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1129)
 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1160)
 at hudson.scm.SCM.checkout(SCM.java:495)
 at hudson.model.AbstractProject.checkout(AbstractProject.java:1203)
 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
 at hudson.model.Run.execute(Run.java:1727)
 at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
 at hudson.model.ResourceController.execute(ResourceController.java:97)
 at hudson.model.Executor.run(Executor.java:429)
 ERROR: Error fetching remote repo 'origin'
 Finished: FAILURE

解决


1)slave节点执行命令:

rm -rf ~/.ssh/known_hosts

2)配置slave节点:
Host Key Verification Strategy选择【Manually trusted key..】

评论

还没有任何评论,你来说两句吧