问题
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 But My question is how to setup Github connection with Jenkins usingPersonal Access Token
回答1:
After many discussion on multiple threads from Stackoverflow
I found one thread which is useful.
Refer to this answer: https://stackoverflow.com/a/61104603/5108695
Basically
Personal access token
can be used as a password, as far as Jenkins
is concerned at least. I added new credentials to the credential manager.
Go to Jenkins
- Go to
credentials
>System
>Global credentials
>Add credentials
a page will open. - In Kind drop-down select Username and password.
- In User put a non-existing username like
jenkins-user
oruser
. - Add
Personal Access Token
in the password field
Now start configuring your project.
- source code management tab, select new configured credentials from Drop-down near credential Under Repository URL
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
来源:https://stackoverflow.com/questions/61105368/how-to-use-github-personal-access-token-in-jenkins