Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use github oAuth token with Git plug-in Jenkins

I have been using Git Plugin in Jenkins to pull the source code from the GitHub repository. I have been using UserName and Password for authentication

enter image description here

However, GitHub has announced

Deprecation Notice: GitHub will discontinue password authentication to the API. You must now authenticate to the GitHub API with an API token, such as an OAuth access token, GitHub App installation access token, or personal access token, depending on what you need to do with the token

So i need to change the authentication to use oAuth token.

1> I have created a oAuth token in GitHub
2> Then in Jenkins i created Secret Text as Global Credentials. (using the GitHub's oAuth token)
3> However, when i goto job configuration, the Git Plug-In does not show any credentials in the DropDownList whose type is secret text ( it shows all other credentials though)

How do i configure Git Pug-in to use oAuth token?

like image 642
LP13 Avatar asked Dec 17 '19 23:12

LP13


1 Answers

Check first if you have the github-oauth Jenkins plugin installed, as described in "Use the Jenkins OAuth plug-in to securely pull from GitHub", from Walker Rowe.

That would allow to register your Jenkins server as an application which can then access GitHub resources:

https://cdn.ttgtmedia.com/rms/editorial/TSS_jenkins_oauth_041018_fig5_desktop.png

like image 163
VonC Avatar answered Oct 17 '22 16:10

VonC