How can I make Jenkins CI with Git trigger on pushes to master?

  • Set the Jenkins job's build trigger to Poll SCM, but do not specify a schedule.
  • Create a GitHub post-receive trigger to notify the URL
http://yourserver/jenkins/git/notifyCommit?url=%3CURL%20of%20the%20Git%20repository%3E?token=%3Cget%20token%20from%20git%20to%20build%20remotely%3E
  • This will trigger all builds that poll the specified Git repository.
  • However, polling actually checks whether anything has been pushed to the used branch.

It works perfectly!