github ssh pubkey失效,总是提示输入密码

➜  ~ ssh -Tv  [email protected]
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/lionqu/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to github.com port 22.
debug1: Connection established.
debug1: identity file /Users/lionqu/.ssh/id_rsa type 0
debug1: identity file /Users/lionqu/.ssh/id_rsa-cert type -1
debug1: identity file /Users/lionqu/.ssh/id_dsa type -1
debug1: identity file /Users/lionqu/.ssh/id_dsa-cert type -1
debug1: identity file /Users/lionqu/.ssh/id_ecdsa type -1
debug1: identity file /Users/lionqu/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/lionqu/.ssh/id_ed25519 type -1
debug1: identity file /Users/lionqu/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/lionqu/.ssh/id_xmss type -1
debug1: identity file /Users/lionqu/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.1
debug1: match: OpenSSH_8.1 pat OpenSSH* compat 0x04000000
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: ecdsa-sha2-nistp256
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: Server host key: ecdsa-sha2-nistp256 SHA256:jivCzDeRrquV8L5Z5RPI52pye89jc+7pn+ZFD+D88Ys
debug1: Host 'github.com' is known and matches the ECDSA host key.
debug1: Found key in /Users/lionqu/.ssh/known_hosts:3
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: Will attempt key: /Users/lionqu/.ssh/id_rsa RSA SHA256:RzxhZ/Y3t3Cp7ljiC3GW7deBqhR36Ri9lgCeFZuOtfs agent
debug1: Will attempt key: /Users/lionqu/.ssh/id_dsa
debug1: Will attempt key: /Users/lionqu/.ssh/id_ecdsa
debug1: Will attempt key: /Users/lionqu/.ssh/id_ed25519
debug1: Will attempt key: /Users/lionqu/.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,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/lionqu/.ssh/id_rsa RSA SHA256:RzxhZ/Y3t3Cp7ljiC3GW7deBqhR36Ri9lgCeFZuOtfs agent
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /Users/lionqu/.ssh/id_dsa
debug1: Trying private key: /Users/lionqu/.ssh/id_ecdsa
debug1: Trying private key: /Users/lionqu/.ssh/id_ed25519
debug1: Trying private key: /Users/lionqu/.ssh/id_xmss
debug1: Next authentication method: keyboard-interactive
Password:

注: 我在本地用 ssh-keygen -t rsa 生成了多次ssh key并且把它们上传到了github后台,但是还是提示输入密码。我生成密钥带密码也没用,怎么输入密码都没用,有道友知道怎么解决么?我的其他服务器都可以用我的pub key。

ssh版本太高了?找个低版本的ssh,ssh-keygen -t rsa试试?

现在猜测两个问题,一个是有cache导致key.不匹配,另一个就是你说的版本问题

密钥算法不对?

https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

$ ssh-keygen -t ed25519 -C "[email protected]"

不知你最终目的是什么。我记得 github 更推荐 GCM 来管理认证:

试试这个命令

git remote set-url origin [email protected]:<username>/<repo>

这个肯定是设置了

其实就是突然失效了,推代码都不行了

可能是墙导致的,我这也没法push,直接被 reset 。

试试我前面贴的两个链接的方法。

我先前也是突然有一天push要求密码,后来改用链接2的方法解决了。

好滴,感谢,我回家试试

还是不行。。。 现在不能拉代码。。 蛋疼

广州电信把 GitHub 解析到 127.0.0.1 了。。。 恶心

https://www.v2ex.com/t/855574 相关讨论

使用 git via https 解决了