Jira DVCS synchronization fails with the "Invalid credentials" error

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

     

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

要約

A DVCS GitHub Enterprise repository synchronization might fail with the error "Invalid credentials, please reset OAuth settings" for a number of reasons.

診断

In the atlassian-jira.log we can observe the error Bad credentials (401), as in the example:

2020-09-09 18:54:55,761 http-nio-x.x.x.x-8081-exec-80 url:/rest/bitbucket...epository/12/sync INFO anonymous 1134x10999251x11 kjlbkc x.x.x.x,x.x.x.x /rest/bitbucket/1.0/repository/12/sync [c.a.j.p.d.r.external.v1.RepositoryResource] Postcommit hook started synchronization for repository [12].
2020-09-09 18:54:55,848 http-nio-x.x.x.x-8081-exec-80 url:/rest/bitbucket...epository/12/sync INFO anonymous 1134x10999251x11 kjlbkc x.x.x.x,x.x.x.x /rest/bitbucket/1.0/repository/12/sync [c.a.j.p.d.spi.github.GithubCommunicator] Can not obtain branches list from repository [ MyREPO ] org.eclipse.egit.github.core.client.RequestException: Bad credentials (401)
 at org.eclipse.egit.github.core.client.GitHubClient.createException(GitHubClient.java:552)
 at org.eclipse.egit.github.core.client.GitHubClient.get(GitHubClient.java:740)
 at org.eclipse.egit.github.core.client.PageIterator.next(PageIterator.java:173)
 at org.eclipse.egit.github.core.service.GitHubService.getAll(GitHubService.java:151)
 at org.eclipse.egit.github.core.service.GitHubService.getAll(GitHubService.java:135)
 at org.eclipse.egit.github.core.service.RepositoryService.getBranches(RepositoryService.java:785)
 at com.atlassian.jira.plugins.dvcs.spi.github.GithubCommunicator.getBranches(GithubCommunicator.java:515)
 at com.atlassian.jira.plugins.dvcs.spi.github.GithubCommunicator.startSynchronisation(GithubCommunicator.java:604)
 at com.atlassian.jira.plugins.dvcs.service.remote.CachingCommunicator.startSynchronisation(CachingCommunicator.java:98)
 at com.atlassian.jira.plugins.dvcs.sync.impl.DefaultSynchronizer.doSync(DefaultSynchronizer.java:173)
 at com.atlassian.jira.plugins.dvcs.service.RepositorySyncServiceImpl.doSync(RepositorySyncServiceImpl.java:440)


Cause 1 - lack of permissions

If the account used doesn't have access to a repository, we'll face the invalid credentials error.

ソリューション 1

Grant access to the GitHub account.


Cause 2 - OAuth token revoked

If for any reason, the token is revoked, you will face this error.

ソリューション 2

Reset the OAuth Settings:

  1. Click on the ellipsis (...) icon and select the Reset OAuth Settings option

  2. Click on Edit
  3. Enter the Key and Secret and click on Regenerate Access Token


Cause 3 - More than 10 organizations

If you have more than 10 organizations for the same account in GitHub Enterprise, you might experience the following:

  • See the "Invalid credentials" error
  • Reset the OAuth settings
  • The sync runs successfully
  • After some hours, the error happens again

ソリューション 3

In this case, then you have to set up the OAuth App via the Organization and not via the Service Account.

To do this, the Service Account needs to have Owner access to the Organization being linked.

参照:

Last modified on Mar 28, 2024

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.