Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Error : Could not checkout <branch name> with start point <SHA1>

I've created a branch from develop branch and configured a Jenkins job for this new branch. Before branching out this new branch actually I'had to remove an existing directory in develop branch (Removed the directory locally then committed the change and pushed to the remote) and so this was the last commit on .

After a force build Jenkins is giving the error "Could not checkout <branch name> with start point <SHA1>". And this SHA1 is the last commit that I've done on the develop branch before branching out this new branch by removing an directory.

I tried several ways like rebuilding, wiping out the work-space and then rebuilding etc. without any luck. Though Jenkins fails to checkout, my local git repository can checkout to this new branch and work on it without any issue.

I'm trying hard to sort out this issue without much success and found this Jenkins issue but I'm not sure whether is the same. https://issues.jenkins-ci.org/browse/JENKINS-26748

Could anybody help me on this issue please?

Following is the full log...

Started by user anonymous
    Building in workspace C:\Projects\CI_01\Jenkins_1.6\jobs\Velo-TFS675-InvoiceRegister\workspace
    Cloning the remote Git repository
    Cloning repository https://git.mesite.com/EAG/Velo.git
     > C:\Projects\Git\bin\git.exe init C:\Projects\CI_01\Jenkins_1.6\jobs\Velo-TFS675-InvoiceRegister\workspace # timeout=10
    Fetching upstream changes from https://git.mesite.com/EAG/Velo.git
     > C:\Projects\Git\bin\git.exe --version # timeout=10
    using .gitcredentials to set credentials
     > C:\Projects\Git\bin\git.exe config --local credential.username ourbuildusr # timeout=10
     > C:\Projects\Git\bin\git.exe config --local credential.helper store --file=\"C:\Users\BUILD~1\AppData\Local\Temp\git8122784540015506.credentials\" # timeout=10
     > C:\Projects\Git\bin\git.exe -c core.askpass=true fetch --tags --progress https://git.mesite.com/EAG/Velo.git +refs/heads/*:refs/remotes/origin/* # timeout=60
     > C:\Projects\Git\bin\git.exe config --local --remove-section credential # timeout=10
     > C:\Projects\Git\bin\git.exe config remote.origin.url https://git.mesite.com/EAG/Velo.git # timeout=10
     > C:\Projects\Git\bin\git.exe config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
     > C:\Projects\Git\bin\git.exe config remote.origin.url https://git.mesite.com/EAG/Velo.git # timeout=10
    Fetching upstream changes from https://git.mesite.com/EAG/Velo.git
    using .gitcredentials to set credentials
     > C:\Projects\Git\bin\git.exe config --local credential.username ourbuildusr # timeout=10
     > C:\Projects\Git\bin\git.exe config --local credential.helper store --file=\"C:\Users\EAGBUI~1\AppData\Local\Temp\git8122784540015506.credentials\" # timeout=10
     > C:\Projects\Git\bin\git.exe -c core.askpass=true fetch --tags --progress https://git.mesite.com/EAG/Velo.git +refs/heads/*:refs/remotes/origin/* # timeout=60
     > C:\Projects\Git\bin\git.exe config --local --remove-section credential # timeout=10
     > C:\Projects\Git\bin\git.exe rev-parse "refs/remotes/origin/tfs675-invoice_register^{commit}" # timeout=10
     > C:\Projects\Git\bin\git.exe rev-parse "refs/remotes/origin/origin/tfs675-invoice_register^{commit}" # timeout=10
    Checking out Revision 7dc4f9190358c20b01d2980e3ba5c7039ace377c (refs/remotes/origin/tfs675-invoice_register)
     > C:\Projects\Git\bin\git.exe config core.sparsecheckout # timeout=10
     > C:\Projects\Git\bin\git.exe checkout -f 7dc4f9190358c20b01d2980e3ba5c7039ace377c # timeout=10
    ERROR: Timeout after 10 minutes
    FATAL: Could not checkout tfs675-invoice_register with start point 7dc4f9190358c20b01d2980e3ba5c7039ace377c
    hudson.plugins.git.GitException: Could not checkout tfs675-invoice_register with start point 7dc4f9190358c20b01d2980e3ba5c7039ace377c
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$8.execute(CliGitAPIImpl.java:1905)
        at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1060)
        at hudson.scm.SCM.checkout(SCM.java:485)
        at hudson.model.AbstractProject.checkout(AbstractProject.java:1282)
        at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
        at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
        at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
        at hudson.model.Run.execute(Run.java:1741)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        at hudson.model.ResourceController.execute(ResourceController.java:98)
        at hudson.model.Executor.run(Executor.java:381)
    Caused by: hudson.plugins.git.GitException: Command "C:\Projects\Git\bin\git.exe checkout -f 7dc4f9190358c20b01d2980e3ba5c7039ace377c" returned status code -1:
    stdout: 
    stderr: 
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1640)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1616)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1612)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1254)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1266)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$8.execute(CliGitAPIImpl.java:1881)
        ... 10 more
like image 936
CAD Avatar asked Sep 26 '22 17:09

CAD


2 Answers

I haven't seen this error exactly as shown. I often see a similar error when the branch it's trying to checkout has been deleted from the remote. But one thing to do, is in the git clone options for your jenkins job, set clean before checkout We also prune stale remote branches

like image 156
twk3 Avatar answered Sep 29 '22 05:09

twk3


To ensure your workspace is not broken, it is good if you can delete the workspace and try to build again. Or use clean before checkout

I did fix my issue by enabling Git LFS after checkout as my repository was using Git LFS.

like image 23
Sebastien Mascha Avatar answered Sep 29 '22 07:09

Sebastien Mascha