r/github • • Aug 12 '26

Discussion Locked out of GitHub due to 2FA after changing phone and laptop — still have working Git credentials on an old Windows PC. Any way to recover?

Locked out of GitHub due to 2FA after changing phone and laptop — still have working Git credentials on an old Windows PC. Any way to recover?

I’m currently locked out of my GitHub account because of 2FA and I’m trying to figure out if there is any legitimate way to recover it.

Here’s the situation:

- GitHub username: `ronit450`

- I recently changed my laptop from Windows to Linux.

- I also recently changed my phone.

- My old phone had the authenticator app that I used for GitHub 2FA, but I no longer have access to it.

- I don't have my GitHub recovery codes.

- I still have full access to the email address associated with the account.

- I know my GitHub username and normal account password.

- Previously, I remember being able to receive a verification code through email in some situations, but that option is no longer available when I try to log in.

- GitHub's account recovery options haven't worked for me.

I contacted GitHub Support, and they told me they cannot bypass or disable 2FA and pointed me toward the normal account recovery process.

**However, I found an old Windows laptop that I previously used for GitHub.**

On that machine, I found that Git Credential Manager still has a GitHub credential stored:

Target: LegacyGeneric:target=git:https://github.com

User: ronit450

Local machine persistence

and it successfully authenticated and downloaded from the repository without asking me for a username, password, or token.

So I know there is currently a working GitHub credential stored on this old Windows machine.

I have not deleted, modified, or extracted the credential.

My question is:

Is there any legitimate way to use this existing authenticated Git credential/session to recover access to my GitHub account or establish ownership through GitHub's official recovery process?

Could the credential stored by Git Credential Manager be a PAT/OAuth credential that could help with account recovery?

I'm not trying to bypass GitHub's security or disable 2FA. I just want to recover my own account, and I can provide whatever legitimate ownership information is required.

Any advice from people who have dealt with a similar situation would be greatly appreciated.

Please don't ask me to post the actual credential/token — I won't share that publicly.

0 Upvotes

6 comments sorted by

View all comments

1

u/ProperAssociation322 Aug 12 '26

The old windows machine is basically AWS instance where l login my git not using ssh but probably https. So when I try to login like verifying ssh on that instance it says it failed

1

u/Ok_Woodpecker_9104 Aug 13 '26

those two are different credentials so the ssh failure doesnt tell you much on its own. pull and push working there is the https token in credential manager, ssh is not involved in that at all.

run this on the box:

ssh -T git@github.com

permission denied (publickey) means no key from that machine is registered on the account and the ssh route is dead. "hi ronit450, youve successfully authenticated" means the key is on the account and you are in.

also worth being precise about which thing failed, because the recovery flow does not log in over ssh. it gives you a token string on the page and asks you to sign it locally:

echo -n "TOKEN_FROM_THE_PAGE" | ssh-keygen -Y sign -n github.com -f ~/.ssh/id_ed25519

then you paste the signature block back. a failed ssh -T and a failed signing challenge are two different failures.

since its an ec2 instance, check that the key you are looking at is not just the ec2 keypair you use to reach the instance. that one was never on your github account and it gets mixed up constantly. what you want is a key in ~/.ssh whose .pub fingerprint matches one listed under your github ssh keys.