Android Studio cannot load GitHub account information
Cannot load information for GitHub account: Bad credentialsShort answer
The IDE sends the token saved in Settings > Version Control > GitHub to GitHub, and GitHub refused it. The token expired, was deleted, lacks a needed scope, or has not been authorized for your organization. Create a new token with the scopes the IDE lists, then add it again with Log In with Token.
Fix it fast
1Find out which cause you have
Test the token outside the IDE. GitHub answers invalid credentials with 401 Unauthorized. Any other answer means the token itself is accepted and the problem is a scope or organization setting.
curl -s -o /dev/null -w "%{http_code}\n" \ -H "Authorization: Bearer YOUR_TOKEN" https://api.github.com/user2Match what you see, then jump to its fix
- 1
The curl test prints 401The saved token expired or was deletedFix - 2
The curl test does not print 401, but the IDE still reports an error for repositories or organizationsThe token is missing a scope the IDE needsFix - 3
Your own repositories load, but the organization's repositories fail (GitHub sends an X-GitHub-SSO header on such refusals)The organization uses SAML single sign-on and the token is not authorizedFix
- 1
What does the error look like?
Cannot load information for GitHub account: Bad credentialsBad credentials
Cause 1 of 3
The saved token expired or was deleted
1Check
On GitHub open your profile picture, Settings, Developer settings, Personal access tokens. A token you set to expire, or one you deleted, is gone from the list or marked expired. GitHub also removes tokens that have not been used for a year.
curl -s -H "Authorization: Bearer YOUR_TOKEN" https://api.github.com/user | head -n 42Fix
Generate a new token (classic: Generate new token, then Generate new token (classic)). In Android Studio open Settings > Version Control > GitHub, click Add, choose Log In with Token and paste it. Or choose Log In via GitHub to sign in through the browser instead of using a token.
# in the browser: GitHub > Settings > Developer settings > Personal access tokens
# in the IDE: Settings > Version Control > GitHub > Add > Log In with Token3Verify
The account row in the GitHub settings page shows your username, and the curl test no longer prints 401.
curl -s -o /dev/null -w "%{http_code}\n" \
-H "Authorization: Bearer YOUR_NEW_TOKEN" https://api.github.com/userConfirmed by docs.github.com
Cause 2 of 3
The token is missing a scope the IDE needs
1Check
JetBrains lists the scopes the IDE expects: repo, gist, read:org, workflow, read:user and user:email. A fine-grained token is not fully supported out of the box, and the IDE shows an error when a permission is missing.
curl -s -D - -o /dev/null -H "Authorization: Bearer YOUR_TOKEN" https://api.github.com/user | grep -i x-oauth-scopes2Fix
Create a classic token with all six scopes ticked and add it in the IDE with Log In with Token. If you use a fine-grained token, grant permissions equal to those scopes.
# scopes to tick on the classic token page
repo, gist, read:org, workflow, read:user, user:email3Verify
The x-oauth-scopes header lists those scopes, and the IDE loads your repositories.
curl -s -D - -o /dev/null -H "Authorization: Bearer YOUR_NEW_TOKEN" https://api.github.com/user | grep -i x-oauth-scopesConfirmed by jetbrains.com
Cause 3 of 3
The organization uses SAML single sign-on and the token is not authorized
1Check
For resources owned by an organization with SAML single sign-on, the token itself has to be authorized for that organization.
curl -s -o /dev/null -w "%{http_code}\n" -H "Authorization: Bearer YOUR_TOKEN" https://api.github.com/orgs/YOUR_ORG/repos2Fix
In GitHub, open Settings > Developer settings > Personal access tokens, find the token, and authorize it for the organization. GitHub's Enterprise Cloud documentation has the exact steps.
# in the browser: token list > Configure SSO > Authorize3Verify
The organization request no longer returns 401 or 404 and the repositories show up in the IDE.
curl -s -o /dev/null -w "%{http_code}\n" -H "Authorization: Bearer YOUR_TOKEN" https://api.github.com/orgs/YOUR_ORG/reposConfirmed by docs.github.com
How do I stop it coming back?
- Prefer Log In via GitHub (OAuth) over a pasted token, so there is no token to expire.
- If you use a token with an expiry date, put the date in your calendar.
- Never commit a token to a repository; keep it in the IDE's saved accounts.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Mobile apps
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
The phone shows as unauthorized and Android Studio will not run the app
adb devices lists the phone but Android Studio cannot deploy to it
An unauthorized phone means it has not trusted this computer's RSA key.
3 causes, each with a fixMobile apps
Android Studio cannot pair the phone over Wi-Fi
The Pair devices over Wi-Fi dialog lists no device
Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.
4 causes, each with a fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fixMobile apps
adb prints 'server version doesn't match this client; killing...'
adb server version doesn't match this client; killing...
adb runs a background server, and every adb command is a client.
3 causes, each with a fixMobile apps
adb tcpip 5555 fails because no device is found
adb: more than one device/emulator
adb tcpip only works while the device is attached and listed by adb, because it tells the phone to start listening on port 5555.
4 causes, each with a fix