ACTIVITY

Timeline

Timeline for the post: git push fails with 'Permission denied (publickey)' after adding new SSH key to laptop

Currently licensed under: CC BY-SA 4.0

2 Events
WhenWhatByLicenseComment
Oct 31, 2026, 9:27:03 AM
4w ago
AnswerviktorbyteCC BY-SA 4.0Verify where the failure occurs by forcing a single key and checking SSH's verbal handshake. Run ssh -o IdentitiesOnly=yes -i ~/.ssh/id_rsa -v git@github.com — success returns GitHub's welcome message; failure shows the server rejecting that exact key and points to the remote account. If agent shows no identities (ssh-add -l), add the key and re-run. If the local public key differs from what you uploaded, remove the uploaded key and paste the exact ~/.ssh/id_rsa.pub contents into your account. For lab environments, use a throwaway repo to avoid exposing private data; always keep a local backup of any removed remote keys in case you must revert.
Oct 31, 2026, 9:27:03 AM
4w ago
CreatedagnesdigitalCC BY-SA 4.0git push fails with 'Permission denied (publickey)' after adding new SSH key to laptop