10

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!!

NicholasKyleHoffman
  • 317
  • 1
  • 4
  • 14
  • 1
    This [answer](http://stackoverflow.com/a/33827734/153487) may resolve your problem. I've fixed my own problem successfully. – Yantao Xie Aug 05 '16 at 07:19

3 Answers3

5
  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.

Dmitry S
  • 4,990
  • 2
  • 24
  • 32
  • Thanks for the response - I've got a much better idea of what I need to do now to get Jenkins + Git integrated!! Also, the network settings snippet has been very useful, so I appreciate that. If I can't get this to work I will most likely reach out again! – NicholasKyleHoffman Aug 27 '15 at 00:55
1

Problem has been resolved. Followed steps here for new keygen. Logged into terminal as: jenkins$ (sudo -i -u jenkins). I was able to eventually add newly generated keys to /Users/Shared/Jenkins/.ssh/id_rsa (I was trying to reproduce how my other ssh keys were stored on my mac in /Users/me/.ssh).

  • I also had to restrict permission levels on the above SSH key folder to avoid getting an error & authenticating with the ssh -T..and added to git -> account settings -> ssh key (specifically for jenkins).

  • After that, I went into Jenkins /configure and added my new private key location to CVS. In my project, I had to add credentials (SSH username w/private key) w/"From the Jenkins master ~/.ssh" radio button selected.

NicholasKyleHoffman
  • 317
  • 1
  • 4
  • 14
1

It is a bit strange but if you are using gitlab.com, it seems that the error is gone when you login to the website (gitlab.com) using the gitlab account used to clone the project from Jenkins.

gersonZaragocin
  • 1,122
  • 12
  • 20