Jenkins Git Plugin: Failed to connect to repository, returned status code 128

NicholasKyleHoffman picture NicholasKyleHoffman · Aug 24, 2015 · Viewed 86.4k times · Source

I'm attempting to clone a remote GitHub enterprise repository and am running into the following error after adding my remote repo's URL to the Git Plugin in my Jenkins configuration:

hudson.plugins.git.GitException: Command "/usr/bin/git -c askpass=true fetch --tags --progress https://github.com/myUsername/myProject.git  refs/heads/*:refs/remotes/origin/*" returned status code 128: stdout: stderr: fatal: unable to access https://github.myOrg.com/myUsername/myProject.git/': Failed to connect to github.com port 443: Operation timed out    at... 

Configuration details & things I have tried:

  • Jenkins URL is at default of http://localhost:8080/ (Getting the warning: "Please set a valid host name, instead of localhost")
  • All dependencies listed have been installed for the Git Plugin
  • I have added git credentials for authorization to my organization's remote repo
  • I tried to add my personal (non-enterprise git account) credentials & repo to the plugin with the same result
  • I have set my "Path to Git executable" to both 'git' and '/usr/bin/git'
  • I can connect to Git both through the command line and in the browser

Questions:

  • Am I somehow supposed to provide authentication (ssh keys) just for Jenkins to use/clone my remote repo?
  • Why does Jenkins throw a warning for leaving the default URL? Does this mean I need to 'put' Jenkins somewhere other than my local machine?

I have been troubleshooting this for a few days now and am unsure of what my problem(s) are at this point! Please help!!

Answer

Dmitry Savinkov picture Dmitry Savinkov · Aug 25, 2015
  1. Regarding your 1st question - you need to associate correct ssh key with appropriate repository. You can do it in /var/lib/jenkins/.ssh/config file - detailed explanation is here this is more robust solution in terms of supporting of multiple git repos OR you can just add correct ssh key into /.ssh folder. For troubleshooting try to perform clone github repo under jenkins user inside your jenkins box.

  2. Regarding your 2nd question. Here are my network settings in jenkins and I have no warning messages: /etc/hosts : 127.0.0.1 localhost localhost.localdomain /etc/sysconfig/network: HOSTNAME=localhost.localdomain. Your hostname and localhost should be resolved inside jenkins server as well.