Jenkins-Github/Git - "Error validating repository information. Credentials ok."
Asked Answered
L

3

8

On Jenkins, While setting up Multibranch setup with "Github" on Jenkins, I get strange error as

Error validating repository information. Credentials ok.

However same credential works for "git" as "Add Source" category but fails for "github" if added as "Add Source". This is actual credential for github and I can login github portal, Not sure what is going on here. Any pointers. Thanks

Longueur answered 6/4, 2021 at 6:2 Comment(0)
R
1

I faced the same issue. This worked for me : create a Personal Access Token (using the steps described here ), and use your PAT as password in the jenkins credentials branch source. And the github username account (the account you create the PAT with) as username in jenkins.

Rackley answered 9/6, 2021 at 21:52 Comment(0)
C
1

Use github personal access token with required permission(scope) to repository in Github as shown below:

admin:repo_hook, repo 
Chrestomathy answered 26/3, 2022 at 15:0 Comment(1)
This answer worked for me. I initially had a "fine-grained token", but even with every option selected for it, Jenkins would throw the error stated on the question. After creating a "classic" token through GitHub, I was able to validate my shared-library on GitHub.Tillion
L
0

This is normally caused by the GitHub API "get a repository" failing to retrive your repository:

Caused: org.kohsuke.github.GHFileNotFoundException: https://github.organization.com/api/v3/repos/<user>/<repo> {"message":"Not Found","documentation_url":"https://developer.github.com/enterprise/2.20/v3/repos/#get"}
    at org.kohsuke.github.GitHubClient.interpretApiError(GitHubClient.java:451)
    at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:382)
    at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:326)

Double check your own "cause by" to see if the same API is involved, and if the URL used is correct.

Larine answered 6/4, 2021 at 6:30 Comment(3)
Sorry for replying I was getting beow error, Error validating repository information.Error validating repository information. Credentials ok. java.io.FileNotFoundException: api.github.com/repos/Xyz/abc-repo Caused: org.kohsuke.github.GHFileNotFoundException: api.github.com/repos/Xyz/abc-repo {"message":"Not Found","documentation_url":"docs.github.com/rest/reference/repos#get-a-repository"} But how to figure out root cause. ThanksLongueur
@Longueur maybe abc-repo is private?Larine
That is why I am providing the credential for private repo. Same works fine on Freestyle Pipeline job. Issue arrives when for multibranch with github category. ThanksLongueur

© 2022 - 2024 — McMap. All rights reserved.