Setup Jenkins for private GitHub repository

Continuous integration is one of the key parts of the modern software development process. Today we will set up the integration of the popular jenkins automation server with the private repositories of the Github service.

I assume that you already have an account on the Github service and have jeknins server configured.

Adding ssh private key to jenkins

Let’s add our ssh key to the jenkins parameters. Follow the links Credentials> jenkins> Global credentials. In the dropdown list, select the option ‘SSH username with private key’ to add the ssh key and fill in all the fields.

dropdown options ssh username with private key
Dropdown option ssh username with private key
Enter you ssh key details
Enter you ssh key details

Checkout private Github repo from pipeline job

Let’s create a new pipeline job. I will use the declarative pipeline syntax in jenkins script. Add the following line to check the checkout git repo.

Let’s run our pipeline. It’s successfully completed!

Check the logs.

Yes, everything worked, we cloning the project from a private Github repository and we can start working with it.

 

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.