Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Android Studio will not log in to GitHub or fails to push

ErrorCan't log in to GitHub from Android Studio

Short answer

Android Studio uses JetBrains' GitHub integration, which signs in with OAuth in the browser or with a token. A login or push fails when the browser login is blocked, the token lacks the scopes the IDE needs, the token expired, or the account was added for the wrong server. Re-add the account in Settings > Version Control > GitHub.

  • Applies to Android Studio current stable, GitHub plugin bundled with the IDE, Windows 11, macOS 26
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Open Settings (Ctrl+Alt+S, or Preferences on macOS) > Version Control > GitHub and look at the account list. Note which server it lists and whether it shows an error.

    # Settings > Version Control > GitHub
  2. 2Match what you see, then jump to its fix

    1. 1Log In via GitHub opens a browser page that never returns to the IDE.The browser sign-in did not completeFix
    2. 2Login works but pull requests or some Git operations fail with permission errors.The token is missing scopes the IDE needsFix
    3. 3A push fails with a warning that the token expired.The token expiredFix
    4. 4Your token is valid on github.com, but the work repository is hosted on a company server.The account was added for github.com but the repository is on an Enterprise serverFix

What does the error look like?

  • Can't log in to GitHub from Android Studio
  • Push to GitHub fails because the token has expired
  • Git operations against a GitHub repository fail from the IDE

Cause 1 of 4

The browser sign-in did not complete

1Check

This method uses OAuth 2.0 in your browser, and with two-factor authentication you enter the code there. A blocked pop-up, a different browser profile or a firewall can stop the return.

# Settings > Version Control > GitHub > Add > Log In via GitHub

2Fix

Use Log In with Token instead: click Generate in the dialog, sign in, click Generate token, paste the token and click Add Account.

# Settings > Version Control > GitHub > Add > Log In with Token

3Verify

The account appears in the list with your user name.

# Settings > Version Control > GitHub

Confirmed by jetbrains.com

Did this fix it?

Cause 2 of 4

The token is missing scopes the IDE needs

1Check

The IDE expects these classic token scopes: repo, gist, read:org, workflow, read:user and user:email. Fine-grained tokens are not fully supported; if you use one, grant permissions equal to those scopes.

# GitHub > Settings > Developer settings > Personal access tokens

2Fix

Create a new classic token with those scopes, then paste it with Log In with Token.

# Add > Log In with Token > paste the new token > Add Account

3Verify

Repeat the operation that failed.

git push

Confirmed by jetbrains.com

Did this fix it?

Cause 3 of 4

The token expired

1Check

A token with an expiry date stops working on that date. The IDE then shows a warning after the failed push.

# GitHub > Settings > Developer settings > Personal access tokens

2Fix

Click Use Token in the warning, insert or generate a new token in the Log In to GitHub dialog, and click Log In.

# warning after the failed push > Use Token > Log In

3Verify

Push again.

git push

Confirmed by jetbrains.com

Did this fix it?

Cause 4 of 4

The account was added for github.com but the repository is on an Enterprise server

1Check

GitHub Enterprise needs its own account entry with the server URL. github.com is used for Enterprise Cloud, example.ghe.com for data residency, and the company URL for self-hosted.

git remote -v

2Fix

Choose Log In to GitHub Enterprise, type the server in the Server field, then add a token for that server.

# Add > Log In to GitHub Enterprise > Server: your server URL > Add Account

3Verify

The Enterprise account is listed beside the github.com one.

# Settings > Version Control > GitHub

Confirmed by jetbrains.com

Did this fix it?

How do I stop it coming back?

  • Give tokens an expiry you will remember and note the date.
  • Use classic tokens with the listed scopes for the IDE until fine-grained tokens are fully supported.
  • Set a default account for each project so the IDE stops asking which one to use.

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

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 fix

Mobile 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

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.