Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Integrate Jenkins Pipeline Project With GitHub

This tutorial will show you how to integrate your "pipeline" Jenkins project with GitHub so that your project builds when specific branches are pushed to (e.g. staging/production).

This tutorial is specific to when you select "pipeline" when creating a new project, but the steps may be the same or similar to other project types.


In Jenkins click configure on your project.

Then click on configure

Navigate down to Build Triggers and select GitHub hook trigger for GITScm polling.

  1. Scroll Down to Pipeline and enter your repository URL (I'm using git path as I'm authenticating with the use of an SSH key).
  2. Specify your credentials (preferably by setting up and using a deploy key unique to this project).
  3. Click Add branch to add branches for each branch you wish to build for.
  4. Specify your branches that you wish to build for here. E.g. I have branches for staging and production.

Go to your GitHub repository and click on Settings, Webhooks, and then Add webhook.

  1. In the Payload URL field, paste the URL you built up in the earlier step.
  2. In the ‘Content type’ select: ‘application/json’
  3. Leave the ‘Secret’ field empty
  4. Just trigger the push event.
  5. Press the button to add the webhook.


Now when you push to your GitHub repository, it will prompt Jenkins to poll for changes and build staging/production if there are changes.


Last updated: 29th June 2021
First published: 27th May 2021