首页 > 解决方案 > 测试与 git 的 SSH 连接提示密码

问题描述

我们已经设置了一个本地 Git 服务器并在其上启用了 SSH 设置。按照此处的指南,我们测试了 SSH 密钥,但它仍然提示我们输入密码。以下是来自 ssh 的日志:

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>
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
debug3: start over, passed a different list publickey,password
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/Eugene/.ssh/id_rsa RSA SHA256:XXX
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
debug1: Trying private key: /c/Users/Eugene/.ssh/id_dsa
debug3: no such identity: /c/Users/Eugene/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /c/Users/Eugene/.ssh/id_ecdsa
debug3: no such identity: /c/Users/Eugene/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /c/Users/Eugene/.ssh/id_ed25519
debug3: no such identity: /c/Users/Eugene/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /c/Users/Eugene/.ssh/id_xmss
debug3: no such identity: /c/Users/Eugene/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
git@git.test.com's password:

该指南说 SSH 设置有问题。我无法看到在哪里,希望在这里得到一些帮助。

标签: gitssh

解决方案


的输出是ssh -T git@github.com什么?

从调试输出中,ssh 客户端无法找到您的私钥的存储位置。我将通过检查以下内容进行故障排除:

  • 确保您已使用 ssh-agent 添加密钥。
  • 仔细检查您的配置文件 ( ~/.ssh/config) 是否具有指向您的身份文件的正确路径。

推荐阅读