GitHub says invalid signature? Your key type may be the problem
If your key predates 2021 and suddenly fails, GitHub now requires sha2 signing.
Published here , updated · 3 sources · Resume reading
GitHub's 2021 SSH cut-over dropped SHA-1 signatures for RSA keys, so an old RSA key can fail while HTTPS remotes still work [1]. Generate an ED25519 key, add the public half in GitHub settings, and point your Host block at that file. Confirm the key type with ssh-keygen before you dig into firewall myths.
Quick start: new ED25519 key
GitHub's own generate-key docs walk Mac, Windows, and Linux through ssh-keygen and the agent [2]. On a Linux box:
ssh-keygen -t ed25519 -C "[email protected]" -f /tmp/ssh-demo-keys/id_ed25519 -N ""
ssh-keygen -l -f /tmp/ssh-demo-keys/id_ed25519.pubCaptured output from a fresh key on this machine:
256 SHA256:rpaSt538a7noySfltGERiIAsfJtkHHqDRHV4FMQ13ks [email protected] (ED25519)Copy the .pub file into GitHub under Settings, SSH and GPG keys. Then test:
ssh -T -i /tmp/ssh-demo-keys/id_ed25519 -o IdentitiesOnly=yes [email protected]A success line names your GitHub user. A failure that still mentions publickey after the new key is uploaded usually means the agent offered a different key first. Put IdentitiesOnly yes and an explicit IdentityFile on the Host github.com block so only that key is tried. Stop typing the full SSH command every time covers that Host layout in detail.
Why RSA keys broke
RSA keys themselves were not banned. GitHub's 2021 post explains that older clients sign with SHA-1 when they use the ssh-rsa signature type, and that SHA-1 is weak [1]. OpenSSH 7.2 and newer can use rsa-sha2-256 and rsa-sha2-512 for the same RSA key material. Keys uploaded after the November 2, 2021 cut-off were required to use SHA-2 signatures during brownouts and after the change became permanent [1].
If your laptop still only offers SHA-1 for RSA, GitHub rejects the signature. The error looks like a bad key even when the private file is fine. ED25519 keys never depended on that SHA-1 path, which is why generating one is the shortest fix [1][2].
See RSA versus ED25519 on disk
ssh-keygen -t rsa -b 2048 -f /tmp/ssh-demo-keys/id_rsa -N "" -C "[email protected]" >/dev/null
ssh-keygen -l -f /tmp/ssh-demo-keys/id_rsa.pub
ssh -Q PubkeyAcceptedAlgorithms | tr ',' '\n' | grep -E 'rsa|ed25519'Captured fingerprint line:
2048 SHA256:+7Jl0lCQlwNzp0ScWrnjymTC3P5NpaRfWr+4Ff2SL+I [email protected] (RSA)Captured algorithm names from this OpenSSH (excerpt):
ssh-ed25519
rsa-sha2-256
rsa-sha2-512
ssh-rsassh-rsa in that list is the old SHA-1 signature algorithm name. rsa-sha2-256 and rsa-sha2-512 are the SHA-2 forms GitHub wants for RSA [1]. A modern default config already prefers the SHA-2 names for RSA keys. Forcing PubkeyAcceptedAlgorithms +ssh-rsa re-enables the weak signature type; that is the opposite of a repair.
GitHub accepts ED25519 and RSA with SHA-2 signatures; SHA-1 ssh-rsa signing is what the 2021 cut-over removed.
Keep RSA only when the client is new enough
If you must keep an RSA key temporarily, upgrade OpenSSH (or Git for Windows's bundled SSH) so ssh -Q PubkeyAcceptedAlgorithms lists rsa-sha2-256 and rsa-sha2-512 [1][3]. Then wire a Host block that pins the key:
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yesCheck the resolve without opening a session:
cat > /tmp/ssh-demo-keys/config <<'EOF'
Host github.com
HostName github.com
User git
IdentityFile /tmp/ssh-demo-keys/id_ed25519
IdentitiesOnly yes
EOF
ssh -F /tmp/ssh-demo-keys/config -G github.com | egrep '^(user|hostname|identityfile|identitiesonly) 'Captured output:
user git
hostname github.com
identitiesonly yes
identityfile /tmp/ssh-demo-keys/id_ed25519Do not add PubkeyAcceptedAlgorithms +ssh-rsa thinking it "forces sha2." That flag restores the old algorithm name. Prefer ED25519 and retire the RSA key in GitHub once clones work [1][2].
Mistakes that look like network outages
Uploading a new public key but leaving five other keys in the agent, so GitHub sees failed attempts before the right one. IdentitiesOnly yes stops that [3].
Debugging with git clone https://... while the failure only happens on [email protected] remotes. HTTPS never exercises your SSH key [1].
Editing /etc/ssh/ssh_config system-wide instead of ~/.ssh/config, then wondering why a CI user still offers RSA SHA-1.
Copying only the private key to a new laptop and forgetting the .pub registration on GitHub, or pasting the private key into the GitHub form.
Treating "invalid signature" as a repo ACL change. Check ssh-keygen -l and the signature algorithms before opening a ticket with your host.
Corporate laptops and old Git installs
Teams stuck on an ancient Git for Windows build, or on a locked-down image that ships OpenSSH 7.1, still hit SHA-1 RSA failures against GitHub even when the private key file is perfect [1]. The durable fix is still ED25519 on a client that supports it. If IT must approve a package bump, collect ssh -V, ssh -Q PubkeyAcceptedAlgorithms, and the failing ssh -vT [email protected] excerpt so the ticket is about signature algorithms, not "GitHub is down."
Some managed configs set PubkeyAcceptedAlgorithms narrowly. If ED25519 is missing from the negotiated list in ssh -v, fix the client policy before rotating keys a second time. Host key algorithms (HostkeyAlgorithms) are a separate list that covers how you verify GitHub's server key; do not confuse them with the client signature algorithms that sign your user key [1].
Multiple GitHub accounts on one laptop
People who use a work GitHub Enterprise account and a personal account often keep two keys. Give each a Host alias:
Host github.com-work
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_work
IdentitiesOnly yes
Host github.com-personal
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_personal
IdentitiesOnly yesPoint remotes at [email protected]:org/repo.git so the right key is offered. Without IdentitiesOnly, the agent may try the personal key against work first and produce confusing failures that look like the 2021 signature issue [3].
After the new key works
Remove the old RSA public key from GitHub once every machine you use has the ED25519 key. Keep private keys mode 600 and the .ssh directory mode 700 so OpenSSH does not refuse them [3]. For deploy keys, give each repo its own ED25519 file and a dedicated Host alias so personal keys never get offered to production remotes.
CI deploy keys deserve the same ED25519 treatment. A self-hosted runner with a ten-year-old RSA key in /home/runner/.ssh will fail the same way a laptop does. Rotate the runner key, update the GitHub deploy-key setting, and confirm ssh -T under the runner user before the next nightly job.
Hardware security keys that speak [email protected] are another path GitHub documents for generate-key flows [2]. They avoid leaving a decryptable private file on disk. Use them when the laptop is shared or high risk; otherwise a file-backed ED25519 key with a passphrase and agent is enough for most developers.
When ssh -T [email protected] greets you and git fetch over SSH succeeds, the signature path is fine. Leave the SHA-1 era keys in the archive folder, not in the agent.
Verbose failures still deserve one careful read of the offered algorithms. In ssh -v output, look for lines that name rsa-sha2-256, rsa-sha2-512, or ssh-ed25519 during publickey auth. If the client only proposes ssh-rsa for your user key, upgrade OpenSSH or switch to ED25519 before you rotate credentials a third time [1]. Keep a short internal note with the working ssh -V so the next teammate does not rediscover the same brownout timeline from 2021. Paste that note next to the Host block in your team wiki when onboarding a new laptop image.
For Host blocks and IdentityFile pinning, see SSH config Host blocks and SSH keys for developers. Browse the Dev tools topic.
Send this to the friend who still has an old RSA key that GitHub rejects.

Keep this guide
Questions about this guide
Which key type should I use?
ED25519 is the recommended choice now. It is small, fast, and well supported on current OpenSSH and GitHub.
How do I check my current key type?
Run ssh-keygen -l -f ~/.ssh/id_rsa.pub (or your key path). The output shows bit length, fingerprint, comment, and type such as (RSA) or (ED25519).
Can I keep an old RSA key?
Yes if your client speaks rsa-sha2-256 or rsa-sha2-512. Prefer generating a new ED25519 key instead of fighting legacy SHA-1 signing.
Sources
- GitHub docs: generate a new SSH keydocs.github.com
- OpenBSD man: ssh-keygenman.openbsd.org