7

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

Krishna
  • 501
  • 1
  • 8
  • 17

3 Answers3

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.

Ridge
  • 11
  • 1
1

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

admin:repo_hook, repo 
Randhir
  • 792
  • 7
  • 18
  • 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. – Neil P. Apr 26 '23 at 02:38
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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Sorry for replying I was getting beow error, Error validating repository information.Error validating repository information. Credentials ok. java.io.FileNotFoundException: https://api.github.com/repos/Xyz/abc-repo Caused: org.kohsuke.github.GHFileNotFoundException: https://api.github.com/repos/Xyz/abc-repo {"message":"Not Found","documentation_url":"https://docs.github.com/rest/reference/repos#get-a-repository"} But how to figure out root cause. Thanks – Krishna May 04 '21 at 20:15
  • @Krishna maybe abc-repo is private? – VonC May 04 '21 at 21:34
  • 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. Thanks – Krishna May 05 '21 at 03:19