I can ask this question in many ways, like How to configure Jenkins credentials with Github Personal Access Token How to clone Github repo in Jenkins using Github Personal Access Token
So this is the problem
The alternate solution that I am aware of
SSH
connectionusername
password
configuration in Jenkins. However, use of a password with the GitHub API is now deprecated.
But My question is how to setup Github connection with Jenkins using Personal Access Token
[UPDATE] The new solution proposed by git is
https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/
Which says:
What you need to do:
https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/#what-you-need-to-do-today
Basically, change the add URL as
https://<access token>@github.com/<userName>/<repository>.git
Something like this
https://<access token>@github.com/dupinder/NgnixDockerizedDevEnv.git
and set the credentials to none.
Thanks to @Gil Stal
[OLD Technique]
After many discussion on multiple threads from Stackoverflow
I found one thread that is useful.
Refer to this answer: https://stackoverflow.com/a/61104603/5108695
Basically
Personal access token
can be used as a password, as far asJenkins
is concerned at least. I added new credentials to the credential manager.Go to
Jenkins
credentials
>System
>Global credentials
>Add credentials
a page will open.jenkins-user
oruser
.Personal Access Token
in the password fieldNow start configuring your project.
So this is how we can configure or setup Authentication between Jenkins and Github using Personal Access Token
References:
Git Clone in Jenkins with Personal Access Token idles forever
Change jenkins pipeline to use github instead of gitlab