Failed to login Github for Android Studio

Viewed 9405
5 Answers

This is not a phishing attack. See thread here: Intellij Android Studio opens localhost page to login on github

Intellij support says that this is an Android Studio bug and recommends using a token as a workaround.

Generating the token

Log in to you GitHub account and navigate to Settings > Developer Settings > Personal Access Tokens

Click "Generate new token"

Add a note so you know this token is for Android Studio and then check the following boxes: repo, read:org, and gist

Click "Generate token"

Now copy the generated token and return to Android Studio.

Log In With Token From Android Studio

In Android Studio, Navigate to File > Settings > Version Control > GitHub

Select the '+' and then choose "Log In with token".

Paste the copied token and click "Add Account"

In case you've entered your GitHub access credentials into that - apparently SSL tunnel - which may lead somewhere very else than to https://api.github.com - your GitHub account likely had been compromised by a phishing attack ...urgently login on the web and change your account password first, then regenerate all personal access tokens, replace all the SSH keys, check if anything else changed. Also check your local PC for malware infection, because to me this seems to be what you're actually dealing with.

For example... any rouge Gradle plugin can patch local config files, alike the one from that GitHub login dialog, or locally install a SSL tunnel as backdoor (these may work both ways). Then some clueless guy comes around, does not understand where he just entered his access credentials, complains that it is not working and takes to the internet, in order to complain some more about it.

140.82.121.4 would be the correct IP address... and it's all over the news (despite 2020).

Also see: OAuth 2.0 authentication vulnerabilities ...in order to back up my claim.

I solved this problem following these steps:

  1. Use SSH (forget https) (E.g., don't use https url for cloning)
  2. Use Personal Access Token (PAT) (forget username/password)

(e.g., Settings > Developer Settings > Personal Access Token)

  1. Update git to latest version (e.g., 2.35.1) //I think this is important
  2. In Github, Uncheck Settings > Developer Settings > Keep my email addresses private

Conclusion: You add Personal Access token in Github. Then from any IDE (e.g., Android Studio, IntelliJ IDEA etc.) you can add remote using ssh (e.g., name: origin, URL: git@github.com:your_github_username/your_git_repo.git. That's it

If not already done,

  1. Configure git global username and email

    git config --global user.name "your_username" && git config --global user.email "your_email"

If in windows, you can add windows credentials for your user, control panel > users > manage your credential > Windows Credentials > Add a generic credential >

Internet address will be git:https://github.com and you need to type in your username and password will be your GitHub Personal Access Token => Click Ok and you are done

Related