'Jenkins - Error fetching remote repo 'origin'
I'm trying to setup the Jenkins Github Pull-Request Builder on a Jenkins node slave, however when I set the refspec to +refs/pull/*:refs/remotes/origin/pr/*
.
The build fails, saying that I couldn't fetch the repo, When the refspec removed, keeping everything else in place (Github pull request builder ticked and configured, branch specifier is set to ${sha1} defaulted to master using string parameter, the build is fine.
Here is the error trace:
git -c core.askpass=true fetch --tags --progress [email protected]:organization/repository.git
+refs/pull/*:refs/remotes/origin/pr/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from [email protected]:organization/repository.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:763)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1012)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1043)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1277)
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:408)
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress [email protected]:organization/repository.git +refs/pull/*:refs/remotes/origin/pr/*" returned status code 1:
Any help would be greatly appreciated.
Solution 1:[1]
In my case this happened because I switched from SVN to git. So I had an exisiting jenkins job with svn. In this job I just changed the source source-code-management
to git. Due to this changing I had an exisiting workspace and by default in this scenario the git client just calls fetch
and not as required git clone
.
To fix it you have to set Additional Behaviours
below source-code-management
to Wipe out repository & force clone
.
Also see jenkins migration from svn to git
Solution 2:[2]
Reason I saw that was because jenkins disk was full for me.
Solution 3:[3]
Try:
clearing out the workspace files of the required job.
rebuilding.
Solution 4:[4]
In my case the workspace directory file permissions were insufficient. The jenkins user has to be the owner of the workspace directory. Having the permissions for the jenkins GROUP is not enough!
# jenkins is owner
sudo chown -R jenkins:jenkins /var/www/jenkins/workspace/
# add jenkins group
sudo chgrp -R jenkins /var/www/jenkins/workspace/
# add other groups that need access
sudo chgrp -R othergroup /var/www/jenkins/workspace/
# add full owner permissions + any other group permissions you need
sudo chmod -R 770 /var/www/jenkins/workspace/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Christian |
Solution 2 | Sheetal Kaul |
Solution 3 | Gavriel Cohen |
Solution 4 | EliteRaceElephant |