Introduction
Github is a source code repository where developers use it to create, store, and manage their code. It's based on the Git utility and provides a distributed version control system, and it has lots of features like access control, bug tracking, task management, and continued integration for their project.
Github personal token access is a very secure way to integrate the Jenkins with GitHub that enable command line API between GitHub and Jenkins, Its mostly uses in Jenkins to git's commands.
Know more about the GitHub token access - https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
Prerequisites
- GitHub Account
- Running Jenkins Server
In this article, I will show you how to generate the GitHub's personal token and integrate with the Jenkins server.
Step 1: Sign-in with GitHub Account
You must have an account with Github in order to generate the personal token. You can use the given URL to open Github.
Once open the Github home page, You need to click on Sign in button in the right side of the web page.
Step 2: Click on Setting Section
Once you have successfully logged in to your Github account, you need to click the profile button at the right top of the web page to get the setting button.
Step 3: Go to Developer Setting
Once you click the setting button under the account profile menu, you should see the developer setting on the left-down side.
Step 4: Click on Personal Access Token
On the developer setting github webpage, you should see the Personal access token button on the left side.
Step 5: Click on Generate New Token (Classic)
You need to click on Tokens (classic) after clicking on the Personal Access Token button. Now you need to click on Generate New Token on the right side at the top.
Step 6: Generate the Token
You need to enter any name, like Jenkins, and you need to select the expiration date of the token. Along with that, you need to select the permission that is suitable for your purpose.
Note – What’s this token for? like Jenkins
Expiration – Select the token expiry date as per your need.
Select scopes – Scopes define the access for personal tokens.
in the end we need to click on Generate token button to get token that will use in Jenkins, I used minimal access permission for Jenkins that already got Jenkins server to git close Jenkins's jobs workspace. You can use more permission that based on your requirements.
Conclusion
In this article, we generated the GitHub access token that will be used in Jenkins. If you are still having any issues, please leave a message below.