Jenkins and github integration using webhooks

Reading Time: 2 minutes


As github has deprecated service integration feature, I had to reconfigure jenkins integration using webhooks. As this is not straightforward to do, this blog post will help you to save some time if you are using github/jenkins integration.


Jenkins github plugin.

Github Personal Access Token.

Lets go down the rabbit hole. You first need to create github personal access token for user that has access to github repository. In my case, that was my github account.

  1. Click on your github avatar
  2. Select Settings
  3. Select Developer Settings
  4. Select Personal Access Token
  5. Enter your github password

Hmmm, possible github UX issue, this is 4th level depth to get to this feature. Step 5 shows that github knows web security.

  1. Click generate new token
  2. Enter meaningful name
  3. Select permissions: admin:repo_hook, repo
  4. Generate token
  5. Copy token. Be careful, this is your only chance to copy it.

Again, proof that github understands web security.

Jenkins Global credentials

Using github token, you will create jenkins global credential.

  1. In jenkins, click credentials
  2. Click global (any of provided links)

My note on jenkins UX. Its free, and I understand that team do not have much resources. But credentials UX is really messed up.

  1. On left, click Add credentials
  2. For kind select secret text
  3. For scope leave Global option
  4. In secret, paste github token.
  5. Enter meaningful description. Trust me, this is very important, otherwise you will not be able to select this credentials.

Jenkins Github settings

  1. Manage Jenkins
  2. Configure System
  3. Scroll down to Github settings
  4. Add github server
  5. Set meaningful name
  6. Leave default API url
  7. Select credentials created in previous step.
  8. Click apply
  9. Click test connection. Following message should appear: Credentials verified for user xxx, rate limit: 4998

Note rate limit. You have 5000 requests per hour for all github integrations, not just Jenkins.

Github repository webhook

  1. Go to github repository that you are integrating with Jenkins. You need to have admin rights for that repo.
  2. Click Settings
  3. Select webhooks
  4. Add webhook
  5. Payload url is jenkins_url_with_http_or_https/github-webhook/
  6. Content type: application/json
  7. Just push event if you only want to trigger jenkins jobs by branch pushes.
  8. Check Active
  9. Click update
  10. Recent deliveries should have green check icon.

If that is not the case, click on latest delivery that will contain HTTP request/response.


Jenkins job build trigger.

  1. Go to your jenkins job
  2. In Build Triggers section, check out: GitHub hook trigger for GITScm polling



  1. Commit something to your repo in branch for which job is configured.
  2. Job should start executing.



I used those two in order to decript all steps in proper order:

  1. Cloud Bees webhooks
  2. Cloud Bees webhook for non multi branch jobs






Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Karlo Smid


  1. hi Karlo,
    thanks for nice artical, i followed all above steps, but still Recent Deliveries shows Service timeout in red traingle.
    please sugest
    Thank you

  2. Hello Karlo, i’ve followed all those steps, but the jobs doesn’t start, the github gives me the 200 response and the logs from jenkins give me the “Received PushEvent for https://repo_address from ip ⇒ https://jenkins_address
    My Jenkins version is 2.138.2.

    Do you have any idea of what could be?
    Thank you

  3. Just leaving my 2 cents here.

    *You have to mark your job as a GitHub project and privide the repo where the config was done(dah)
    *You need to add a stage for pulling the github repo (git ‘https://github.com/user/repo.git’, in a pipeline)
    *You need to manually run the job at least once (I read this on some documentation)

    After that it works like a charm

  4. It will not work if it is a forked repo, which is private right?
    Although I already set up the ssh key for it

  5. Hi, what’s the exact URL to the GitHub plugin that must be used with the new GitHub Webhooks?

Leave a Reply

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

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