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
• 16,220 points
542 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
• 42,280 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,280 points
503 views
0 votes
2 answers

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

To automatically run build on code commit, follow ...READ MORE

answered Jul 31 in Jenkins by Sirajul
• 37,080 points
244 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,890 points
259 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,880 points
1,053 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
211 views
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
• 42,280 points
1,517 views