My Primary doubt is how github authentication happens in jenkins?
Task: We have to establish connection in jenkins with github repo for "GitHub Pull Request Builder".
GitHub Auth ----> GitHub Server API URL: https://api.github.com (Why we are giving this value? We did not give any of repository name here, So, how authentication is happening?) ----> credentials: I have given mine and tested with "connect to API", Response is: Connected to https://api.github.com as null (null) login: {{ my_user_name }}
----> But if i give my colleague credentials (which are already listed under credentials) and tested with "Connect to API" then below error has been coming.
Unable to connect to GitHub API: org.kohsuke.github.HttpException: {"message":"Requires authentication","documentation_url":"https://docs.github.com/rest/reference/users#get-the-authenticated-user"
GitHub Pull Request Builder
GitHub Auth
GitHub Server API URL https://api.github.com
Help for feature: GitHub Server API URL
Jenkins URL override
Help for feature: Jenkins URL override
Shared secret
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
Help for feature: Shared secret
Credentials user_name/****** (github user)
Add
Help for feature: Credentials
Test basic connection to GitHub
Error:
Connect to API
Unable to connect to GitHub API: org.kohsuke.github.HttpException: {"message":"Requiresauthentication","documentation_url":"https://docs.github.com/rest/reference/users#get-the-authenticated-user"}
Could someone please help on this?
I found out, how you do it. Basically Jenkins doesn't like different access tokens in global and Job specific Authentication.
While connecting to github, you need to give credentials. For GitHub Pull Request Builder
, you need to use access token for setting up credentials for a given Github Server API Url. Authentication is done based on your access token.
When you are creating a job, at that time you are required to give your github url
. A job will be created for that particular github repository.
You can read more here .
Don't use your username and password. It doesn't work. Use a Personal access token from your Github account and use it as a secret text credential with Jenkins.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.