The following steps show how to trigger a build by using github webhooks in Jenkins. The rpre requirements here are :
- make sure jenkins in installed and git plugin is installed.
 - git is installed .
 - path of git.exe is valid in jenkins global tool configuration.
 
Please refer to my other articles if you have trouble in setting up the environment.
- open jenkins and click on new item. This would take you to the screen as shown below:
 - Give a name and select freestyle project.Click Ok.
 - This will redirect to another screen.Enter description of the job if needed or else move the source code management section.
 - Under source code management section select git and paste the git repository url as shown below:
 - Now if you move to next section you find build triggers , under that select GitHub hook trigger for GITScm polling.
 - Selecting this, if jenkins will receive PUSH GitHub hook from repo defined in Git SCM section it will trigger Git SCM polling logic.
 - Now we need to set up webhook on our repositpory. So go to the github repository mentioned above in the git scm section.
 - When we go to the repository, click on settings and then webhooks. Under webhooks click on add new webhook. The screen should look like this:
 - Here under the payload URL we need to mention the details of the jenkins service we are running inorder to receive the HTTP POST information from github.com
 - Here in my case I am running jenkins on my local machine, so I am providing the URL as below:
 - If you have a secret provided during jenkins installation you can add this here and there is also a flexibility to select on which event we want the webhook to trigger.
 
In this way, we can setup webhook and trigger build in Jenkins.