【发布时间】:2021-10-09 18:19:57
【问题描述】:
当我尝试使用 ssh 从 GitHub 克隆我的项目时。
git clone git@github.com:{myname}/{myproject}.git
终端提示我输入
git@github.com's password:
在此之前,我已经生成了公钥,并放在了 GitHub 帐户中。
我的命令是
ssh-keygen -t rsa -C "$my_email"
而且我不知道为什么在使用 git clone 时要输入密码,我尝试了我的 Github 帐户和 Linux 帐户。但它没有用。我在这里错过了什么?
当运行ssh -Tv git@github.com
我得到了
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [$my_linux_WAN_ip] port 22.
debug1: Connection established.
debug1: identity file /home/deeplearn/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/deeplearn/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/deeplearn/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/deeplearn/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/deeplearn/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/deeplearn/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/deeplearn/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/deeplearn/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 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: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:V2mCp8e57TQ9rLfhLv+ATIDG/l0c3z0Ynr2T/r7zdks
debug1: Host 'github.com' is known and matches the ECDSA host key.
debug1: Found key in /home/deeplearn/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
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
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:EwlVGDfp7GYd+LT8l+dconPRVKhfwSbzkX2CRu+xIZA /home/deeplearn/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/deeplearn/.ssh/id_dsa
debug1: Trying private key: /home/deeplearn/.ssh/id_ecdsa
debug1: Trying private key: /home/deeplearn/.ssh/id_ed25519
debug1: Next authentication method: password
git@github.com's password:
【问题讨论】:
-
ssh -Tv git@github.com的输出是什么?请复制/粘贴文本并将其格式化为代码以使其可读。 -
在尝试对 repo 使用 git 之前,您是否添加了私钥(使用
ssh-add)?欢迎来到 SO! -
debug1: identity file /home/deeplearn/.ssh/id_rsa type 0 debug1: key_load_public: No such file or directory表示您实际上并未将密钥存储在系统上。没关系如果您正在使用 ssh-agent 将密钥存储在其他地方并将其传递给需要它的程序... -
"debug1: 可以继续的身份验证:publickey,password" Github 的 ssh 服务器不提供密码身份验证。远程软件版本对于 github 的服务器也是错误的。你实际上并没有与 github 通信。根据“连接到 github.com...”这一行,您实际上是在连接到您的本地系统之一...?