Make a Pipeline project in the Jenkins with any project name
In the general configuration, under the Build Triggers click the checkbox of GitHub hook trigger for GITScm polling
And in the Pipeline configuration select the pipeline script and click on the pipeline syntax under the script box
Another pipeline syntax window opens with several settings options , go to snippet generator , you will get its overview with the steps
under the sample steps select the dropdown button and select the "checkout : Checkout from version control" and under SCM provide your repo and credentials and make sure the branch here and in your github repo matches , and then click on "Generate Pipeline Script"
the script will be generated copy it and paste it in the main jenkins window's script in place of "steps{' '}" and save it.
Procedure for GitHub webhook Creation
Go to your repo inside the github.com , go to settings and select the webhooks
select the AddWebhook and provide the Jenkins URL of your project
Click on the Add Webhook, the webhook is now created
To observe the triggering build in jenkins
Make some changes in your project folder inside your github.com only
After making the changes Commit the changes to your branch.
Then observe the Automatic Triggering of the build inside the Jenkins server
Create the final CI pipeline on Jenkins