GitHub closed the SSH connection because none of the keys your computer offered match a key on your account. The error is about the key, not your password.
Always connect as git, never your username. Remote URLs look like git@github.com:you/repo.git.
ssh-add -l lists loaded keys. Nothing listed? Generate a key, or load it with ssh-add.
Compare the fingerprint with Settings, then SSH and GPG keys on GitHub. Add the public key if missing.
Only ever share the public key (the .pub file). The private key stays on your computer.
you@laptop ~ % ssh -T GITHUB-USERNAME@github.com Permission denied (publickey). you@laptop ~ % ssh -T git@github.com Hi USERNAME! You've successfully authenticated, but GitHub does not provide shell access.
The first command shows the common mistake: connecting as your username. The messages are as shown in the GitHub Docs page for this error. The success line is the usual reply to ssh -T git@github.com.
git remote set-url origin git@github.com:OWNER/REPOSITORY.gitssh-add -l, then ssh-add ~/.ssh/id_ed25519 if it lists nothingeval "$(ssh-agent -s)"..pub file into GitHub, Settings, SSH and GPG keys, New SSH keyssh-add -l -E sha256 with the list on GitHub.sudoRun ssh -T git@github.com. You should see "Hi USERNAME! You've successfully authenticated". For detail, run ssh -vT git@github.com and read the "identity file" and "Offering public key" lines: "Trying private key" with no offer means no key file was found. Then try your git push or git clone again. Chapter 15 walks through setup step by step.
fatal: Could not read from remote repository.Usually follows this errorFix the key problem above, and check the remote URL with git remote -v.fatal: Authentication failedThat is HTTPS, not SSHSee the authentication fix.GitHub rejected your SSH connection because none of the keys offered match a key on your account.
GitHub identifies you by your key, not by a username. All SSH connections must be made as git, such as git@github.com.
Run ssh-add -l to list loaded keys, or ssh -vT git@github.com for detailed connection output.
Never. Add only the public key (.pub) to GitHub. The private key stays on your computer.