Work & cloud tools

GitHub account hacked? Here’s what to do

Move fast and in the right order: reclaim the account through GitHub’s official flow, kick the attacker out of every session, then close the door they came through — usually a password that leaked in a breach and was reused.

ByNikita Silianov· Founder & CEO ·LinkedIn
Quick answer

If your GitHub account was hacked: start recovery at the official page (docs.github.com/en/authentication/keeping-your-account-and-data-secure/updating-your-github-access-credentials), change the password to a unique one, sign out all other sessions, and re-check the recovery email and phone on the account. Then find out how the attacker got in — check whether your password appears in known breach data — and turn on two-factor authentication so it can’t happen again.

Recover your GitHub account, step by step

These steps follow GitHub’s official process. Official links only: account recovery · password reset.

1

Reset your password and sign out everywhere from Settings - Sessions.

2

Revoke ALL unrecognized personal access tokens, OAuth apps, SSH/GPG keys and Codespaces.

3

Re-enable 2FA (security key or authenticator) and download fresh recovery codes.

4

Audit recent commits, new deploy keys and Actions workflows; rotate any secrets that were exposed.

What trips people up with GitHub

  • GitHub takeovers are supply-chain events: attackers push malicious commits or steal private code and secrets. After recovery, ROTATE every secret, token and SSH key - assume anything in your repos or Actions is compromised.
  • Personal access tokens, OAuth apps and SSH keys all bypass the password. Revoke every one you do not recognize, or the attacker walks back in without needing your login.

Still logged in? Lock the account down now

If you can still get in, you're racing the attacker. In this order: change the password to a long, unique one; sign out all other sessions/devices (the setting exists in GitHub's security settings); confirm the recovery email and phone number are yours (attackers quietly add their own so they can "recover" the account later); remove unfamiliar linked apps or API access; and turn on two-factor authentication. Only then deal with anything the attacker posted, sent or bought.

Locked out of GitHub — email or phone was changed

This is the worst-case scenario and the most common complaint: the attacker changed the account email, phone number or password so the normal reset flow emails them, not you. Do NOT keep triggering password resets — they go to the hacker. Go straight to GitHub's dedicated recovery flow (link above), which is built for exactly this case: it verifies you by your original signup details, previous passwords, linked devices or a government ID / selfie check, bypassing the stolen email. Watch for the security notice GitHub sent to your OLD email when the address was changed — it usually contains a "revert this change" link that works for a limited time and is the fastest way back in.

Got a "new login" alert from GitHub?

Treat it as real but verify it the safe way: never tap the link in the message itself (fake login alerts are a top phishing template for GitHub). Open the app or type the address yourself, check the active-sessions list in security settings, and if you see a device or location you don't recognize, sign it out and change your password immediately. If the alert was genuine, that password is burned — assume it's circulating and change it everywhere else you reused it.

Lost your 2FA device or codes

If you changed phones or lost access to your authenticator, use the backup codes you saved when enabling 2FA — that's exactly what they're for. No backup codes? GitHub's account-recovery flow (link above) can verify you through other signals — original signup details, linked email, purchase history or ID verification — but it's deliberately slow, since the same door would otherwise let attackers in. Start the process immediately and respond fast to any follow-up; recovery requests that go quiet get closed.

Why this happened — and how to make sure it can’t again

About a third of account takeovers are credential stuffing: a password you used on GitHub (or the email behind it) leaked in some other company’s breach, and attackers replayed it here automatically. The FBI’s IC3 logged over 5,100 account-takeover complaints with $262M in losses in 2025 alone (IC3). Even when GitHub itself was never breached, your reused password from another site opens it.

So after recovery, check what’s already out there: our free scanner shows which known breaches and dark-web dumps include your email — and whether passwords were exposed with it.

Check my exposure — free →

After you recover: three doors to close

  1. Unique password + 2FA. A password manager plus app-based two-factor stops both stuffing and phishing replays.
  2. Reset everywhere you reused that password — email first (it’s the master key), then bank, then the rest.
  3. Shrink your public footprint. Attackers research targets on data-broker sites (your address, phone, relatives — enough to social-engineer support lines). Our free opt-out guide covers 190 of them, step by step.
Common questions

Hacked GitHub account, answered

How did my GitHub account get hacked?

The most common cause isn't a hack of GitHub itself — it's credential stuffing: a password you used on GitHub leaked from some other site's breach, and attackers tried it here automatically. Roughly a third of account takeovers happen this way, with phishing (fake GitHub login pages and alerts) close behind. That's why the first fix is a unique password, not just a new one.

Can I get my GitHub account back?

Usually yes. Use the official recovery flow (https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/updating-your-github-access-credentials) — it can verify you even when the attacker changed the email and password. Be patient and respond quickly to follow-ups so the case stays open.

Should I just make a new GitHub account instead?

Not until you've tried recovery. The old account keeps your history and contacts — and while the attacker controls it, it will be used to scam people who trust you. Recover it, or at minimum report it as compromised so GitHub can lock it, before you start over.

How do I stop my GitHub account being hacked again?

Three things close most of the doors: a unique password (a manager makes this painless), app-based two-factor authentication, and shrinking your exposed footprint — checking your email against known breach databases and removing your personal data from data-broker sites that attackers use to research targets.