How to integrate jenkins with github

How to Integrate Jenkins with GitHub?

In this article, Learn How to Integrate Jenkins with Github. Jenkins is an open-source automation tool that helps in the building, testing, deploying, integration, and delivery of a software product. Using Git Plugin, any source could be easily fetched from the Git repository that is accessible via the Jenkins build node. This is one essential skill assessed in the Jenkins Certification exam. 

Git is an open-source version control system and one of the most popular tools used by developers to manage their codes. DevOps engineers with knowledge and experience in handling Jenkins are in high demand. In this article, let us learn Jenkins and GitHub integration.


Before moving to the steps to integrate Jenkins and GitHub, make sure you meet the following prerequisites.

  • Server with Jenkins up and running
  • GitHub plugin installed on the Jenkins server
  • GitHub Account

Also Read: GitHub vs Jenkins: A Detailed Comparison

Step 1: Create a Jenkins Job

Let’s start by creating a new Jenkins job. Click on the “New Item”, give it a name, pick the “Pipeline” option and click on the OK.

create jenkins job

Step 2: Configure GitHub Hook Trigger

On the configuration page, scroll down until the section “Build Triggers” and select the option “GitHub hook trigger for GITScm polling”

Note: We are going to setup this pipeline to trigger whenever a new commits happens on Github repository.

jenkins build triggers

Step 3: Create a GitHub Repository

create github repo

Step 4: Connect a GitHub Repository

Scroll down to the “Pipeline” section. We will configure Jenkins to use GitHub repository as source. Select “Pipeline Script from SCM” under the definition option.

From SCM dropdown, select “git”.

In the repository URL section, paste the GitHub repository URL which you want to use for this pipeline. In my case, I am using the repository which I have created in the previous step.

conntect github repo

Type the Jenkinsfile path and click on save.

set script path jenkins

Step 5: Adding a WebHook in GitHub

Login to GitHub and go to the repository which you have connected in the previous step.

webhook settings in jenkins

Click on “WebHooks” and then click on “Add WebHooks”.

add webhook in jenkins

In this page, we will configure Jenkins URL so that GitHub will call Jenkins for the actions. In the “Payload URL” section, enter Jenkins server URL which is accessible over the public internet.

In the content type dropdown, select the option “application/json”. Leave the remaining fields as it it click on Add Webhook. You will see a message stating that the Webhook has been created.

webhook created msg in jenkins

Step 6: Manually Building Jenkins Job

Now go back to the Jenkins dashboard and click on the Job which we have created and then click on “Build Now” from the left.

manual build

Step 7: Trigger Build with GitHub Commit

Go to your GitHub repository and add a new commit by making any changes and within few seconds, you can see the build is running on the Jenkins dashboard.


Hope this Jenkins tutorial was helpful to you and you are able to understand how relevant and crucial GitHub and Jenkins together become. If you are preparing for the Jenkins certification exam, then keep learning for more and deeper understanding of Jenkins! 

About Dharmalingam N

Dharmalingam.N holds a master degree in Business Administration and writes on a wide range of topics ranging from technology to business analysis. He has a background in Relationship Management. Some of the topics he has written about and that have been published include; project management, business analysis and customer engagement.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top