Jenkins Git Init Fails

69 views
Skip to first unread message

Sverre Moe

unread,
Oct 14, 2020, 12:21:38 PM10/14/20
to Jenkins Users
Cloning Git with an old version of Git now seems to fail

Cloning the remote Git repository ERROR: Error cloning remote repo 'origin' hudson.plugins.git.GitException: Could not init /home/build/jenkins/workspace/rebuild-packages/base at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:990) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:748) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:161) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:154) at hudson.remoting.UserRequest.perform(UserRequest.java:211) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:369) 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 sles11.0-x86_64_2 at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1788) at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356) at hudson.remoting.Channel.call(Channel.java:998) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146) at sun.reflect.GeneratedMethodAccessor569.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132) at com.sun.proxy.$Proxy111.execute(Unknown Source) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1122) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1167) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ... 4 more Caused by: hudson.plugins.git.GitException: Command "git init /home/build/jenkins/workspace/rebuild-packages/base" returned status code 129: stdout: stderr: usage: git init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2430) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2360) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2356) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1916) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:988) ... 11 more

Is there any way to modify the git checkout to work around this problem?

               checkout(
                    changelog: false,
                    poll: false,
                    scm: [$class: 'GitSCM',
                        branches: [
                            [name: "origin/" + releaseBranch]
                        ],
                        doGenerateSubmoduleConfigurations: false,
                        extensions: [
                            [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false, timeout: 25],
                            [$class: 'RelativeTargetDirectory', relativeTargetDir: projectName]
                        ],
                        submoduleCfg: [],
                        userRemoteConfigs: [
                            [credentialsId: 'c9c2577f-f23', url: URI]
                        ]
                    ]
                )

Mark Waite

unread,
Oct 14, 2020, 1:21:19 PM10/14/20
to Jenkins Users
Several alternatives:
  • If the repository is a smaller repository (less than 50 MB), then you could enable JGit in your installation and use JGit instead of command line git to perform the checkout.
  • Define a "git tool" for that target machine which will install and use a newer version command line git on that agent.
  • Compile a recent version of command line git on that target machine yourself so that it has the recent version available.
  • Replace 'checkout scm' by shell calls to perform the equivalent operation (git init, git config, git fetch, git checkout)
Command line git is now version 2.28.0, with 2.29.0 ready to release very soon.  Using command line git versions prior to 2.0 will miss many, many improvements that have been made to command line git.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/744aad86-7046-411e-9f40-cbd83f5954c8n%40googlegroups.com.

Sverre Moe

unread,
Oct 20, 2020, 2:39:49 AM10/20/20
to Jenkins Users
Thanks for the suggestions.

We had an SUSE Linux Enterprise Server 11 Build Agent, and it had Git-1.6 installed
I downloaded the Git distribution and performed a manual build and install.
On second thought perhaps using the "git tool" would be prefferable.

Reply all
Reply to author
Forward
0 new messages