gitauthenticationgithubjenkinsjenkins-github-plugin

Jenkins - Github Plugin - Using Personal Access Token (required after Aug 13, 2021 change)


We were using GitHub plugin with Username and password credentials so far in our Jenkins setup.

However, after Aug 13th, 2021, this stopped working raising this error:

stderr: remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.

As per the answer provided by in How to use Github Personal Access Token in Jenkins

I modified the URL to be:

https://<access token>@github.com/<userName>/<organization>/<repository>.git

but it did not work.

Am I missing any steps here?


Solution

  • Create your Private access token using below URL

    https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

    After that In Jenkins Job under Source Code Management section, provide Git repository URL in the format https://access_Token_Number@github.com/<Your_Org>/yourRepoName.git

    e.g if Repo name is abc,Organization is test and Token number is 12345678 then URL will be look like

    https://12345678@github.com/test/abc.git

    Screenshot: Git Private Access Token binding

    This method resolved my problem.