github configures the public key and still prompts [email protected]'s password: Permission denied, please try again. The solution

Recently, when configuring GitHub's ssh for a new computer, everything is configured according to the configuration process of the documentation on GitHub, but after configuring the public key to GitHub, a prompt still appears when operating the warehouse

[email protected]'s password:
Permission denied, please try again.

But it doesn't work to enter the github password as prompted.

After tossing for a long time, I tried to delete and regenerate the key, reconfigure the public key, what file permissions, configure the key to the agent, etc., but it still doesn’t work. I almost doubt my life.
But the same operation is normal on gitlab. It seems that there is nothing wrong with my operation, and it should be related to github.

later use

ssh -Tv [email protected]

To test the link and print the log, the following log appears

PS C:\Users\XeonYu> ssh -Tv [email protected]
OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to github.com [223.75.236.241] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\XeonYu/.ssh/id_rsa type 0
debug1: identity file C:\\Users\\XeonYu/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\XeonYu/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\XeonYu/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\XeonYu/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\XeonYu/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\XeonYu/.ssh/id_ecdsa_sk type -1
debug1: identity file C:\\Users\\XeonYu/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file C:\\Users\\XeonYu/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\XeonYu/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\XeonYu/.ssh/id_ed25519_sk type -1
debug1: identity file C:\\Users\\XeonYu/.ssh/id_ed25519_sk-cert type -1
debug1: identity file C:\\Users\\XeonYu/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\XeonYu/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.6
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.4*,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\\XeonYu/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\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\\XeonYu/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\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\\XeonYu/.ssh/known_hosts:1
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: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: C:\\Users\\XeonYu/.ssh/id_rsa RSA SHA256:90nUQDrAT7CL+A72pV710fQxoPq4Jp2wmm03u/2c3X0
debug1: Will attempt key: C:\\Users\\XeonYu/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\XeonYu/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\XeonYu/.ssh/id_ecdsa_sk
debug1: Will attempt key: C:\\Users\\XeonYu/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\XeonYu/.ssh/id_ed25519_sk
debug1: Will attempt key: C:\\Users\\XeonYu/.ssh/id_xmss
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\\XeonYu/.ssh/id_rsa RSA SHA256:90nUQDrAT7CL+A72pV710fQxoPq4Jp2wmm03u/2c3X0
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: C:\\Users\\XeonYu/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\XeonYu/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\XeonYu/.ssh/id_ecdsa_sk
debug1: Trying private key: C:\\Users\\XeonYu/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\XeonYu/.ssh/id_ed25519_sk
debug1: Trying private key: C:\\Users\\XeonYu/.ssh/id_xmss
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
[email protected]'s password:
debug1: Authentications that can continue: publickey,password,keyboard-interactive
Permission denied, please try again.
[email protected]'s password:
debug1: Authentications that can continue: publickey,password,keyboard-interactive
Permission denied, please try again.
[email protected]'s password:
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey,password,keyboard-interactive).

To be honest, I didn't see any problem.
Later, I continued to look through the github documentation and saw this
https://docs.github.com/cn/authentication/troubleshooting-ssh/using-ssh-over-the-https-port

insert image description here

So try to execute

ssh -T -p 443 [email protected]

It actually succeeded... It seems to be a so-called firewall problem.
insert image description here

Add the following content to the config file according to the document prompts. If there is no config, create a new one yourself (in your .ssh folder), and delete the suffix.

Host github.com
Hostname ssh.github.com
Port 443
User git

then run again
insert image description here

That's ok, it's really a pit...


If you think this article is helpful to you, please give it a thumbs up. It can help more developers. If there are any mistakes in the article, please correct me. For reprinting, please indicate that you are reposting from Yu Zhiqiang’s blog, thank you !

Guess you like

Origin blog.csdn.net/yuzhiqiang_1993/article/details/127032178