Search code examples
gitgithubjenkinssshjenkins-plugins

Jenkins hangs at git fetch


I'm a beginner with Jenkins and I'm trying to get it to run some unit tests in my.NET project.

When I run a build it hangs when trying to fetch from the Git repository.

ERROR: Timeout after 10 minutes
 > C:\Program Files\Git\cmd\git.exe config --local --remove-section credential # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/name.of.repo

I've generated the known hosts and copied the .ssh dir to C:\Windows\SysWOW64\config\systemprofile.ssh as per the jenkins instructions at https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin under "Jenkins, GIT plugin and Windows"

I ran ssh git@github.com from the command line and I can successfully authenticate.

What can I try next?


Solution

  • This is probably a firewall issue. You can authenticate to Github using SSH (port 22), so that route is working. Your job however is trying to access github via https://github.com (port 443) which timeouts. Try accessing github over ssh by changing the repository url to git@github.com:account/repository.git (you can find this URL on the main page of the repo, dropdown 'Choose a clone URL', option 'SSH'.