Jenkins - Add Git Webhook Access Token
I recently had to re-deploy Jenkins (version Jenkins 2.361.2) and noticed that my git webhooks for my pipeline would no longer work because they now need to provide a token for security. These webhooks were used in order to have Github notify Jenkins that there was a change, and it may need to run the pipeline. Luckily, this is easily resolved by executing the following steps:
Steps
On the Jenkins landing page, click Manage Jenkins.
Click on Configure Global Security.
Scroll down to Git plugin notifyCommit access tokens and click the button to Add new access token.
In the form field, enter a name for your project that the token will act as a webhook for. Then click Generate.
Copy the token (1), before then clicking Save.
Now you just need to update your webhook URL to include it by appending
&token=yAccessTokenHere
E.g.
http://jenkins.mydomain.com:8080/git/notifyCommit?url=https://github.com/my-github-username/name-of-my-repository&token=myAccessTokenHere
First published: 28th October 2022