There are multiple approaches in integrating Jenkins with GitHub
Approach 1) Enable ssh communication between GitHub and Jenkins by copying public key file generated in Jenkins to GitHub account. This is one time task.
For any pipeline take any GitHub url(say ssh://git@github.com/account/repo.git
) and add using Github plugin for that respective pipeline cocnfiguration
So, Jenkins file just need to have checkout SCM
to checkout
Approach 2) Enable https communication by adding webhook for every new repo by generating token and enable https comunication between GitHub and Jenkins. But this approach should be repeated for every new repo created in GitHub.
We are using GitHub repo... in production
Which is the best practice of GitHub integration with Jenkins in production?