Yesterday I updated github's fingerprint, but after that I cannot use ssh to connect to github.com anymore.
I've tried to regenerate key and added it to github. But it still doesn't work.
ssh -vT [email protected]
:
OpenSSH_8.9p1, OpenSSL 1.1.1n 15 Mar 2022
debug1: Reading configuration data /c/Users/23097/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [223.75.236.241] port 22.
debug1: Connection established.
debug1: identity file /c/Users/23097/.ssh/id_rsa type -1
debug1: identity file /c/Users/23097/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/23097/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/23097/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/23097/.ssh/id_ecdsa_sk type -1
debug1: identity file /c/Users/23097/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /c/Users/23097/.ssh/id_ed25519 type 3
debug1: identity file /c/Users/23097/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/23097/.ssh/id_ed25519_sk type -1
debug1: identity file /c/Users/23097/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /c/Users/23097/.ssh/id_xmss type -1
debug1: identity file /c/Users/23097/.ssh/id_xmss-cert type -1
debug1: identity file /c/Users/23097/.ssh/id_dsa type -1
debug1: identity file /c/Users/23097/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6
debug1: compat_banner: match: OpenSSH_7.6 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to github.com:22 as 'git'
debug1: load_hostkeys: fopen /c/Users/23097/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-rsa SHA256:rEmlJenVMSL5GVemSY0Gk8WGw6B4ege4J85M vup8R0
debug1: load_hostkeys: fopen /c/Users/23097/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /c/Users/23097/.ssh/known_hosts:2
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: agent returned 2 keys
debug1: Will attempt key: /c/Users/23097/.ssh/id_ed25519 ED25519 SHA256:0k6E5hrjYHm9AdhrRF5Rp6Rb Gxx4Ln 01Uf626Y9nA agent
debug1: Will attempt key: [email protected] ED25519 SHA256:f5kZ2jUz0HAWNkB3juN3lhxNy MMpBCTgJtXC0vBx/U agent
debug1: Will attempt key: /c/Users/23097/.ssh/id_rsa
debug1: Will attempt key: /c/Users/23097/.ssh/id_ecdsa
debug1: Will attempt key: /c/Users/23097/.ssh/id_ecdsa_sk
debug1: Will attempt key: /c/Users/23097/.ssh/id_ed25519_sk
debug1: Will attempt key: /c/Users/23097/.ssh/id_xmss
debug1: Will attempt key: /c/Users/23097/.ssh/id_dsa
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: /c/Users/23097/.ssh/id_ed25519 ED25519 SHA256:0k6E5hrjYHm9AdhrRF5Rp6Rb Gxx4Ln 01Uf626Y9nA agent
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Offering public key: [email protected] ED25519 SHA256:f5kZ2jUz0HAWNkB3juN3lhxNy MMpBCTgJtXC0vBx/U agent
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /c/Users/23097/.ssh/id_rsa
debug1: Trying private key: /c/Users/23097/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/23097/.ssh/id_ecdsa_sk
debug1: Trying private key: /c/Users/23097/.ssh/id_ed25519_sk
debug1: Trying private key: /c/Users/23097/.ssh/id_xmss
debug1: Trying private key: /c/Users/23097/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
[email protected]'s password:
I have id_ed25519
and id_ed25519.pub
in my .ssh folder, and I'm sure I've added it to github's ssh keys. Plz any suggestions?
CodePudding user response:
If you look at the output carefully, you will see that your SSH client has offered a key to the server, but the server has declined it. It has then tried a bunch of default private key filenames ... which presumably don't exist. Finally it has switched to asking for a password.
So ... the most likely explanations are:
- You didn't copy the public key to the GitHub settings page.
- You didn't copy the entire key.
- You forgot to click the
Add Keys
button after pasting it. - You didn't add the private key to your shell's ssh-agent before attempting to connect. (Doing that will prompt for your private key's passphrase.)
Note: A public key doesn't have a password / passphrase. The passphrase is on the private key.
(What would be the point of a passphrase to protect a public key? It is supposed to be readable by anyone / everyone who wants to use it.)
For reference: "Adding a new SSH key to your GitHub account"
CodePudding user response:
I encountered the same problem today...
In my case, on the first time that I tried to push to GitHub today, it warned me with "REMOTE HOST IDENTIFICATION HAS CHANGED".
Thus I updated GitHub fingerprint, and on the second push it prompted me to input "[email protected]'s password"
After several trail, I found I can't even connect to GitHub.com in web browser without using proxy, I don't know if it is the same with you.
Then I manually set GitHub's IP address in hosts... and everything goes back to normal...