Security7 min readUpdated November 23, 2026

What Do I Do If I Forgot My GitHub Password?

The reset is easy until 2FA is involved. Then it becomes a recovery-code problem, and GitHub will not bail you out.

Reset a forgotten GitHub password at github.com/password_reset using your primary or backup email. If you also lost your 2FA, you need a recovery code, a saved passkey, or GitHub Mobile. GitHub Support cannot restore an account with 2FA if you lose every recovery method. The fix is to store the password and the recovery codes in a password manager before you need them.

Reset a forgotten GitHub password at github.com/password_reset. Enter the email address on your account and GitHub sends a reset link. Only primary and backup email addresses work, so use one you still control.

How do I reset a forgotten GitHub password?

Reset a forgotten GitHub password at github.com/password_reset. Enter the email address on your account and GitHub sends a reset link. Only primary and backup email addresses work, so use one you still control.
The link expires in 3 hours. If it does not arrive, check spam before you request another. If 2FA is enabled, GitHub will ask you to confirm with a passkey, a security key, or GitHub Mobile before it lets you set a new password. Once you are in, set a new password and store it in your password manager. The reset is the easy part. The hard part is the account you cannot reset because you also lost the second factor.

What happens if I also lost my GitHub 2FA?

If you lost your 2FA, the password reset is not enough. You need a recovery code, a saved passkey, or GitHub Mobile to get past the second factor. Without one of those, the reset link leads to a wall.
GitHub gives you recovery codes when you set up 2FA. Those codes are the way back in. If you saved them, use one. If you added a passkey or a security key, use that. If you set up GitHub Mobile, you can approve from the app. This is the scenario that locks people out permanently. The password is recoverable through email. The second factor is not, unless you saved a way around it. That is why the recovery codes matter more than the password.

Can GitHub Support recover my account?

GitHub Support cannot restore access to an account with 2FA if you have lost your 2FA credentials and every recovery method. This is stated plainly in their docs, and it is deliberate. If support could bypass 2FA, 2FA would be worthless.
What you can do is unlink the email address tied to the locked account. That email can then be linked to a new or existing account. You keep the email, but the old account, its repos, and its history are gone unless you had another way in. This is why the recovery codes are not optional. They are the difference between a five-minute recovery and starting over. Save them when GitHub shows them, and store them where you can reach them without the phone you might lose.

How do I prevent losing GitHub access again?

Prevent it by storing the password and the recovery codes in a password manager, and by adding a second recovery method. The manager remembers the password and autofills it. The recovery codes live next to the login, so you can reach them from any device.
Add a passkey or a security key as well. Two independent ways in means losing one device does not lock you out. GitHub lets you register multiple 2FA methods for exactly this reason. Then treat the recovery codes like a password. Do not screenshot them into your camera roll or leave them in a drawer. Put them in the vault, protected by the same master password and 2FA as everything else. The goal is that no single lost device can lock you out of your code.

Where should I store GitHub recovery codes?

Store GitHub recovery codes in your password manager, in the same item as the login. That keeps the password, the one-time password seed, and the recovery codes together, so a single lookup gets you back in.
Do not store them in a screenshot, a notes app, or a drawer. A screenshot syncs to a photo cloud. A notes app is often plaintext. A drawer is lost in a move. None of those survive the moment you actually need them. If you want a paper backup, print the codes and keep them somewhere physically secure, like a safe. That is a reasonable second copy for the codes you cannot regenerate. But the primary copy belongs in the vault, next to the account it recovers.

4 Tips to Get Started

1

Reset at github.com/password_reset with your primary or backup email. The link expires in 3 hours, so check spam and act fast.

2

Save your 2FA recovery codes in your password manager, not in a screenshot or a drawer. They are the only way back in if you lose your phone.

3

Add a passkey or a security key as a second recovery method. Two independent ways in beats one.

4

Store your GitHub password in a manager so the next reset is a lookup, not a recovery.

Ready to Stop Worrying About Infra?

Knowledge is the first step. Get a free 1-hour diagnostic and see where your infrastructure leaks time, money, and focus.

Sources & References

roqy.io cites authoritative sources including engineering blogs, vendor documentation, industry surveys, and academic research to ensure accuracy.

R

Ron Cohen — Founder & DevOps Engineer

Content reviewed by the roqy.io team. Our guides are based on publicly available data and cited sources above.

Disclaimer: This content is for informational and educational purposes only. It does not constitute professional advice or a guarantee of specific results. Infrastructure needs vary by team, stack, and stage. Consult a qualified engineer for advice tailored to your situation.

Frequently Asked Questions

How do I reset my GitHub password?

Go to github.com/password_reset, enter the email on your account, and click the link GitHub emails you. The link expires in 3 hours. If 2FA is on, you will confirm with a passkey, a security key, or GitHub Mobile.

What if I forgot my GitHub password and lost 2FA?

You need a recovery code, a saved passkey, or GitHub Mobile. If you have none of those, GitHub Support cannot restore an account with 2FA enabled. You can unlink the email and start a new account, but the old one is gone.

Does GitHub Support reset passwords?

GitHub Support does not restore access to accounts with 2FA if you have lost your 2FA credentials and every recovery method. This is by design. The recovery codes you saved at setup are the way back in.

How do I stop forgetting my GitHub password?

Store it in a password manager. The manager remembers it, autofills it, and keeps your 2FA recovery codes next to it. You stop relying on memory for a credential you use a few times a month.

Get the DevOps Ecosystem Behind You

One accountable engineer. Full platform behind him. Month-to-month, no lock-in.