ghprb-plugin: Unable to fetch origin - Workspace corruption?

Hello, I’ve been trying to use this plugin to run jenkins on new pull requests, and initially I was successful. However, after a short period of time (fifteenish minutes), it would being crashing on new requests with this error:

Building in workspace /var/lib/jenkins/jobs/Libras Pull Requests/workspace
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url git@github.com:71lbs/libras.git # timeout=10
Fetching upstream changes from git@github.com:71lbs/libras.git
 > git --version # timeout=10
using GIT_SSH to set credentials 
 > git fetch --tags --progress git@github.com:71lbs/libras.git refs/pull/*:refs/remotes/origin/pr/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@github.com:71lbs/libras.git
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:803)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
	at hudson.scm.SCM.checkout(SCM.java:495)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
       and etc...

The only way I was able to get it working again is by deleting the job’s workspace, and have it pull down a fresh clone. Is there any settings that I can use to get to always pull down a fresh clone, or is this some sort of error with the plugin?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (2 by maintainers)

Most upvoted comments

@MasterSlowPoke

I had exactly the same stack trace with this error message: “ERROR: Error fetching remote repo ‘origin’” I was getting it as soon as my repository in GitHub was set to private. Everything was configured correctly in Jenkins and Github.

I searched for days and surprisingly, this worked, no Jenkins restart is even required: https://stackoverflow.com/a/37753202/5484068

#I was on Windows Server 2012 R2, open a CMD in your Jenkins installation as an Admin, and run this: git config --global --unset credential.helper git config --system --unset credential.helper

Was having the exact same problem and the above did not work.

Solution for me was to clear the workspace dir @ /var/lib/jenkins/workspace/*

i have encountered the same error, i have tried both solution proposed above but still could not resolve the problem. Anyone could give any further suggestion?

Cloning the remote Git repository Cloning repository git@github.com:XXXXX/yyyyyyyy

git init /var/lib/jenkins/workspace/XXXXX_yyyyyyyy_dev-AGDDFTC2ZP23THKIP7FEBDRPRXF44PPITX4ID7CTIJKEFWRUZ7NA # timeout=10 Fetching upstream changes from git@github.com:XXXXX/yyyyyyyy git --version # timeout=10 using GIT_ASKPASS to set credentials fetch credential for XXXXX git fetch --tags --progress git@github.com:XXXXX/yyyyyyyy +refs/heads/:refs/remotes/origin/ ERROR: Error cloning remote repo ‘origin’ hudson.plugins.git.GitException: Command “git fetch --tags --progress git@github.com:XXXXX/yyyyyyyy +refs/heads/:refs/remotes/origin/” returned status code 128: stdout: stderr: ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1996)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1715)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:405)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:614)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1120)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1160)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

=================

@myu8tbgl Same. I’ve purged the workspaces, purged the project, re-installed Git on the slave, upgraded Jenkins from ~1.6 to 2.118, purged jenkins on the slave (as far as I know at least) and re-installed it, deleted the node and re-created it. From the shell on my slave (both cmd and WSL) I’m able to ssh to my git server (ssh git@mygitserver) without issue, etc…

And yet my projects’ console output still report the git permission issues.

This all started around the time I upgraded from ~1.7 to 2.17 on my slave. After 2 days, I downgraded to the now deprecated version, and it seems to have fixed the problem. 😞