Git – Jenkins: ERROR: Error fetching remote repo ‘origin’

gitJenkinsjenkins-plugins

I'm a relative novice with Jenkins and am trying to simply run a build from code stored on Bitbucket. I am using git. I have setup the job source control as https protocol as:
url: https://myaccount@bitbucket.org/myaccount/myrepo.git
credentials: username/password

the 'build' section points to the pom.xml in the root and runs the clean test maven goal

I have the Git plugin 2.5.2

I am running Jenkins as a Windows service (Windows 10).

The error on building the project is

ERROR: Timeout after 10 minutes

git.exe config –local –remove-section credential # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://username@bitbucket.org/username/myrepo.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:799)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1055)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1086)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1270)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1720)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Caused by: hudson.plugins.git.GitException: Command "git.exe -c core.askpass=true fetch –tags –progress https://username@bitbucket.org/username/myrepo.git +refs/heads/:refs/remotes/origin/" returned status code -1:

Any advice welcome

Best Answer

as I answered here https://stackoverflow.com/a/43964812/908936 :

try to disable use of the git credential cache using

git config --global --unset credential.helper

You may also need to do

git config --system --unset credential.helper if this has been set in the system config file