How to use Github Personal Access Token in Jenkins

≯℡__Kan透↙ 提交于 2020-07-08 15:18:49

问题


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 connection
  • username password configuration in Jenkins But My question is how to setup Github connection with Jenkins using Personal 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 or user.
  • 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!