Still requiring ssh password after setting SSH Key on github

Issue

This Content is from SuperUser. Question asked by Q.Grain

I switched my proxy client from ssr to clash for windows for some reason. Then I got an Error prompt of DNS changing of github.com in known_hosts while using git clone.

So I deleted the item and git clone again, still failed. Then I re-generated a ssh key pair through ssh-keygen -t rsa -C “my-comment” and stored on github->settings->SSH keys. While testing ssh -vvvT git@github.com, it required password of git@github.com.

Here’s the debug output:

OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug2: resolving "github.com" port 22
debug2: ssh_connect_direct
debug1: Connecting to github.com [223.75.236.241] port 22.
debug1: Connection established.
debug1: identity file C:\Users\Zhiyu/.ssh/id_rsa type 0
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6
debug1: match: OpenSSH_7.6 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to github.com:22 as 'git'
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: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ssh-rsa SHA256:rEmlJenVMSL5GVemSY0Gk8WGw6B4ege4J85M+vup8R0
debug3: hostkeys_foreach: reading file "C:\Users\Zhiyu/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file C:\Users\Zhiyu/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from github.com
debug3: hostkeys_foreach: reading file "C:\Users\Zhiyu/.ssh/known_hosts"
debug3: record_hostkey: found key type RSA in file C:\Users\Zhiyu/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from 223.75.236.241
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in C:\Users\Zhiyu/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: C:\Users\Zhiyu/.ssh/id_rsa RSA SHA256:jO+os6x3rIy+5c/z92Q7yMY9RLUbLLXMvTwzM7mMiKs agent
debug1: Will attempt key: C:\Users\Zhiyu/.ssh/id_dsa
debug1: Will attempt key: C:\Users\Zhiyu/.ssh/id_ecdsa
debug1: Will attempt key: C:\Users\Zhiyu/.ssh/id_ed25519
debug1: Will attempt key: C:\Users\Zhiyu/.ssh/id_xmss
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
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>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: C:\Users\Zhiyu/.ssh/id_rsa RSA SHA256:jO+os6x3rIy+5c/z92Q7yMY9RLUbLLXMvTwzM7mMiKs agent
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: C:\Users\Zhiyu/.ssh/id_dsa
debug1: Trying private key: C:\Users\Zhiyu/.ssh/id_ecdsa
debug1: Trying private key: C:\Users\Zhiyu/.ssh/id_ed25519
debug1: Trying private key: C:\Users\Zhiyu/.ssh/id_xmss
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred:
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
debug3: failed to open file:D:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory
git@github.com's password:

My Envs with SSH keys configured:

Windows 11 (Fail, requiring password) [OpenSSH 8.1p1].
WSL2 Kali on Win11 (Fail, requiring password) [OpenSSH 8.7p1].
Ubuntu18 VM (Success with ssh -T git@github.com) [OpenSSH 7.6p1].
I also tried to scp UbuntuVM:~/.ssh/id_rsa* Win11:~/.ssh/ and test with ssh -T git@github.com, but it still failed with password requiring.

I’m really confused. 🙁



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from SuperUser , is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?