In order to integrate Jenkins with GitHub, all you require is a plugin. The GitHub plugin for Jenkins allows you to schedule your build and facilitates easy transfer of data from the GitHub repository to Jenkins machine. Moreover, it also triggers each build automatically after each commit.

This not only saves time, but also allows you to incorporate your project in the CI (Continuous Integration) process.

Get Started with GitHub Plugin for Jenkins

  1. Install the GitHub Jenkins plugin.
  2. Configure the plugin:

a) Select ‘Configure System’ by going to the Manage Jenkins option.image002

b) Add GitHub Server by going to the GitHub Section.

c) Add the credentials and click Save.

Untitled

  1. Open your Jenkins Project:

a) Ensure that the GitHub project option is checked and provide your GitHub repository path in the Project URL.image009

b) Check Git under Source Code Management and set the GitHub Repository URL in Repositories.image011

c) Go to ‘Build Triggers’ and ensure ‘Build when a change is pushed to GitHub’ is checked.

image013

4. Set a webhook to your Jenkins after installing the Jenkins plugin.

a) Go to GitHub repository->Settings->Integrations & Services.

b) Add ‘Jenkins (GitHub plugin) from Add Service.

image015image017

c) Set the URL of your Jenkins machine as Jenkins Hook URL. Add /github-webhook/

You may also like: How to Build Maven with Jenkins?