How to trigger a Jenkins build when a push is made to a private github repository How to trigger a Jenkins build when a push is made to a private github repository jenkins jenkins

How to trigger a Jenkins build when a push is made to a private github repository


I had a similar problem, and after looking at the main Jenkins System Log I saw the following:

Feb 15, 2013 8:35:44 PM hudson.security.csrf.CrumbFilter doFilterWARNING: No valid crumb was included in request for /github-webhook/.  Returning 403.

The solution is to switch off the CSRF protection - Manage Jenkins > Configure System > Prevent Cross Site Request Forgery exploits. The checkbox is just at the bottom of the first configuration section. After that it all seemed to work happily.


Create a logger with trace level logging for the com.cloudbees.jenkins category under your /log url (Manage Jenkins-> System logs).

Verify that there is a Webhook URL entry under the Service Hooks section of your repository administration screen.

Click test hook and you should see some log activity under your newly created logger.

Finally, check the GitHub Polling log action on the build which you have configured to be triggered by GitHub pushes.

A common mistake is testing commit hooks like this without having a change present.

The hook is only used to prompt a poll and won't perform a build unless changes are detected.