To integrate with GitHub so that changes pushed to the repository will trigger a build on Jenkins, we will need to use two plugins:
- Git plugin (plugins.jenkins.io/git): Enables Jenkins to clone and pull from any Git repository that it has access to. Also adds Git-specific environment variables to the build environment so you can use it during any build steps.
- GitHub plugin (plugins.jenkins.io/github): Allows you to set up a service hook on GitHub that will send a message to our Jenkins instance each time a change is pushed to GitHub. The GitHub plugin also depends on the Git plugin.
These two plugins should be installed if you followed the standard installation; otherwise, install them before moving forward.
For the GitHub plugin to automatically set up service hooks for us, we must provide it with the credentials we stored earlier. Go to Manage Jenkins | Configure Systems and under the GitHub section, add a new GitHub Server:

In the Credentials field, select the credential we stored in the previous name. Then, click Test connection so Jenkins can send a dummy request to GitHub to ensure the token is a valid one. Now, our GitHub plugin will be able to perform actions on our behalf.