Authenticate Jenkins CI for Github private repository

0 votes
I want Jenkins to automatically fetch data from my private repo hosted on github.

I tried generating the ssh key for Jenkins user and the only thing I can see is “unable to clone the repo”.
Aug 13, 2018 in Jenkins by Hannah
• 14,080 points
332 views

1 answer to this question.

0 votes

when you have a server that needs pull access to a single private repo. This key is attached directly to the repository instead of to a personal user account.

If you have a Jenkins user, you can store your deploy key in ~/.ssh/id_rsa. When Jenkins tries to clone the repo via ssh, it will try to use that key.

In some setups you cannot use the default ssh key location. In such cases you create a key in different location(~/.ssh/deploy_key) and configure ssh in ~/.ssh/config.

Host github-deploy-myproject
    HostName       github.com
    User           git
    IdentityFile   ~/.ssh/deploy_key
    IdentitiesOnly yes

we create a host alias github-deploy-myproject because you don’t want to use the above keys to all your github connections. Your clone URL now becomes

git clone github-deploy-myproject:myuser/myproject
answered Aug 13, 2018 by Kalgi
• 37,320 points

Related Questions In Jenkins

0 votes
1 answer

Which is better jenkins of TFS 2015 for CI/CD?

Visual Studio and TFS have been using ...READ MORE

answered Aug 21, 2018 in Jenkins by ajs3033
• 7,240 points
274 views
0 votes
1 answer

How to auto build a job in jenkins if there is any change in code on Github repository?

Yes this is possible. Follow these steps. 1. ...READ MORE

answered Jun 20 in Jenkins by Arvind
• 1,530 points
53 views
0 votes
1 answer

Why is it displaying Jenkins build failure for Android app

I think you should try this. Try Uninstalling ...READ MORE

answered Apr 12, 2018 in Jenkins by shubham
• 6,870 points
198 views
0 votes
2 answers

Is possible for Jenkins to auto start and stop slave nodes?

Try Jenkins Plugin called as Slave SetupPlugin. This ...READ MORE

answered Aug 6, 2018 in Jenkins by Nilesh
• 6,900 points
620 views
+13 votes
2 answers
0 votes
1 answer
+1 vote
3 answers
+2 votes
4 answers

Jenkins integration for dotnet test

You can use the following Pipeline code ...READ MORE

answered Aug 8, 2018 in Jenkins by Kalgi
• 37,320 points
918 views