Reputation: 31
This is a weird issue and we've tried possible solutions from stackoverflow yet still cannot solve it. After SA's weekend patch and reboot, our jenkins job cannot build...
Console output for all projects-
> /usr/bin/git fetch --tags --progress /home/user/repositories/git/user.git
+refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from /home/user/
repositories/git/user.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:735)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:983)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1016)
at hudson.scm.SCM.checkout(SCM.java:484)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1270)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(
AbstractBuild.java:609)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.
java:531)
at hudson.model.Run.execute(Run.java:1717)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:537)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --
tags --progress /home/user/repositories/git/user.git +refs/heads/*:refs/
remotes/origin/*" returned status code 128:
stdout:
stderr: error: cannot run git-upload-pack '/home/user/repositories/git/user.
git': No such file or directory
fatal: unable to fork
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(
CliGitAPIImpl.java:1591)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.
launchCommandWithCredentials(CliGitAPIImpl.java:1379)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(
CliGitAPIImpl.java:86)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl
.java:324)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:733)
... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE
git repository and jenkins are on the same server, ssh should not be used. Source Code Management has Repository URL configged as /home/user/repositories/git/user.git git repository is read/writable by all users.
login server as jenkins, run
/usr/bin/git fetch --tags --progress /home/user /repositories/git/user.git +refs/heads/:refs/remotes/origin/
It can fetch successfully from the git repository without any problem.
Upgrade jenkins to 1.600, GIT client plugin to 1.17.1, GIT Plugin to 2.3.5 still doesn't work
New Item - Freestyle project , gradle project, not specify JDK in Configure System, can fetch when build-
Fetching upstream changes from /home/user/repositories/git/user.git
/usr/bin/git --version # timeout=10
/usr/bin/git fetch --tags --progress /home/user/repositories/git/user.git +refs/heads/:refs/remotes/origin/
/usr/bin/git rev-parse refs/remotes/origin/master^{commit} # timeout=10
/usr/bin/git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 Checking out Revision c6223c5c4693dc9be933b9e4b2fa915fea311891 (refs/remotes /origin/master) /usr/bin/git config core.sparsecheckout # timeout=10
/usr/bin/git checkout -f c6223c5c4693dc9be933b9e4b2fa915fea311891
/usr/bin/git rev-list 050ac61d242b61ab88f533932820cab4e44db7b7 # timeout= 10 [Gradle] - Launching build. [PROJECT] $ /var/lib/jenkins/tools/hudson.plugins.gradle.GradleInstallation/ Main/bin/gradle ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
After specify JDK, jenkins cannot fetch from git, same error
New Maven project cannot work, same error
Check the workspace of new maven project- There is only a ".git" folder, within that branches hooks info objects refs config 156 B view description 73 B view FETCH_HEAD 0 B view HEAD 23 B view
Check the workspace of new free style project-
.git
.settings
PROJECT
.gitignore 329 B view
.project 385 B
Any suggestions on what else we can check to get this solved? Thanks!
Upvotes: 3
Views: 4416
Reputation: 601
I had this same problem and it was caused by Jenkins plugin EnvInject. After I removed that plugin, everything started to work. It is a mystery to me why configuration of JDK messed things up, but definitively the root cause was EnvInject itself.
Another issue I had was that I didn't have properly configured git binary: Manage Jenkins -> Configure System -> Git -> Path to Git executable. After I changed the value to absolute location of git (/usr/bin/git), everything started to work.
Upvotes: 0
Reputation: 24040
You probably shouldn't be using a shared writable Git repo in this way. If you've ended up with some directories without the shared writable or executable bit then other users won't be able to go into them.
That said, the error message is given here:
stderr: error: cannot run git-upload-pack '/home/user/repositories/git/user.git': No such file or directory
It looks like this isn't showing up as a directory, or the Jenkins job can't read it. Run ls -lR on that name to see if it comes up with a list, and if so, whether all directories have the correct permissions bits to allow 'other' to read/write to them (or that all your users including Jenkins are in a suitable group and it is group read/write).
Upvotes: 0