2

Recently I have pushed some code changes directly from my develop branch to remote/develop branch on Bitbucket, then Jenkins unable to build the codes and getting the below error.

Started by user XXXX
 > git rev-parse --is-inside-work-tree # timeout=10
Setting origin to ssh://git@XXXX.git
 > git config remote.origin.url ssh://XXXXX.git # timeout=10
Fetching origin...
Fetching upstream changes from origin
 > git --version # timeout=10
 > git config --get remote.origin.url # timeout=10
using GIT_SSH to set credentials jenkins-generated-ssh-key
 > git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/* # timeout=10
hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: error: object file .git/objects/45/069050ab17bc02837813a835e828fe9570ccbb is empty
error: object file .git/objects/45/069050ab17bc02837813a835e828fe9570ccbb is empty
fatal: loose object 45069050ab17bc02837813a835e828fe9570ccbb (stored in .git/objects/45/069050ab17bc02837813a835e828fe9570ccbb) is corrupt

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2318)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1905)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:81)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:488)
    at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:365)
    at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:325)
    at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:391)
    at jenkins.scm.api.SCMSource.fetch(SCMSource.java:582)
    at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:98)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:293)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE
kowsky
  • 12,647
  • 2
  • 28
  • 41
Kishore Kumar
  • 909
  • 2
  • 10
  • 15
  • Try solutions given there: https://gist.github.com/yblee85/0614f3021d21e2d47139 and SO solution: https://stackoverflow.com/questions/11706215/how-to-fix-git-error-object-file-is-empty – Dev.rb Jun 18 '19 at 03:59

1 Answers1

2

The simple approach I did:

cd /var/lib/jenkins/caches
sudo rm -rf ./*

Kudos: https://vsjttyk.blogspot.com/2018/11/jenkins-cannot-access-git.htm

CacO3
  • 66
  • 5