Re: Jenkins GitHub Integration

1,235 views
Skip to first unread message

KEVIN FLEMING (BLOOMBERG/ 731 LEXIN)

unread,
Jan 28, 2013, 3:23:20 PM1/28/13
to jenkins...@googlegroups.com
You can create a .netrc file in the home directory of your Jenkins user on the machine(s) where you are doing the git operations; this will allow Git to perform HTTP authentication without actually prompting for a username/password combination.


From:jenkins...@googlegroups.com
To:jenkins...@googlegroups.com
Date: 1/28 14:49


Hi,  

    I have the same issue with private repository. Hope someone can provide a pointer.

    git version 1.7.9.5
    jenkins -- 1.500  
    Jenkins GIT plug -- 1.1.26
    GitHub plugin -- not available from the "available plugins" . This is available from the previous version of Jenkins (1.499)
    ubuntu on AMS EC2 instance

    I have setup the ssh keys with the proper login name (email) to the git hub. And put the public ssh key  to the github SSHKey. 
    Tested the  

    ssh -T g...@github.com 

   works and authenticated. 

    in Jenkins, I selected the git as repository and put the github's HTTPS URL. 

    With public repository, there is no problem; but with private repository, I got the following error message: 


Failed to connect to repository : Command "git ls-remote -h https://github.com/xxxx/test.git HEAD" returned status code 128:
stdout: 
stderr: fatal: Authentication failed


     I tried to the same command on the command line, 

      git ls-remote -h https://github.com/xxxx/test.git 

    the command prompt me for the login and password, once I provides the both, the commend returns me the refs results. 

    I can also git clone the above project from command line. 

    It looks to me that the Jenkins is complaining about the login and password prompt.  

    I googled around and found one way to work around the issue is to ssh-agent and use ssh-add to result this. but this requires start the ssh-agent ....
     
    

    is this the only way to do this, for sure I am not the first one to connect the jenkins to  github's private repository.   Please help. 

thanks
Chester








On Sunday, September 23, 2012 6:52:02 AM UTC-7, Ramesh Ankam wrote:
Hello Group,
 
I installed Jenkins 1.4.x on Linux/Tomcat6. We have our code base in GitHub, we are unable to get clone the workspace for public and private GitHub repositories. I receive following error when repo url is added to Git option in Source Control. Any suggestions on how to fix the problem.
 
Failed to connect to repository : Error performing command: ls-remote -h https://github.com/wakaleo/game-of-life.git HEAD
 
Thanks,
Ramesh Ankam
Loading...

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group, send email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Chester Chen

unread,
Jan 28, 2013, 3:33:17 PM1/28/13
to jenkins...@googlegroups.com, KEVIN FLEMING
Kevin, 

  thanks for the reply, I am not familiar with .netrc, what should I put into the .netrc file ? 


Chester

KEVIN FLEMING (BLOOMBERG/ 731 LEXIN)

unread,
Jan 28, 2013, 3:37:30 PM1/28/13
to jenkins...@googlegroups.com
The first hit in a Google search for "git .netrc" is:

https://gist.github.com/1072829

... and it shows you exactly what to do.


From:che...@tingatech.com
To:jenkins...@googlegroups.com
Cc:KEVIN FLEMING (BLOOMBERG/ 731 LEXIN)
Date: 1/28 15:33


Chester Chen

unread,
Jan 28, 2013, 3:49:17 PM1/28/13
to jenkins...@googlegroups.com, KEVIN FLEMING
Kevin, 

    Thanks worked !!!! 
     The only draw back is that now I have the clear password in the .netrc file. 

     very much appreciated. 

Chester

n8g...@n8gray.org

unread,
Jan 29, 2013, 9:02:42 PM1/29/13
to jenkins...@googlegroups.com, KEVIN FLEMING
For secure storage use a git credentials helper.  See this answer on SO:

Kyle Boon

unread,
Feb 1, 2013, 8:31:06 AM2/1/13
to jenkins...@googlegroups.com, KEVIN FLEMING
You set up an ssh key with github but then you provided a url with HTTPS as the protocol so your ssh key isn't being used. Use the SSH URL of your git repo and it should work without needing a username and password.
Reply all
Reply to author
Forward
0 new messages