Failed to add the RSA host key for IP address 'xxx' to the list of known hosts (/home/webapp/.ssh/known_hosts).
我把所有权从ec2用户改为webapp。现在我有:
Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
ssh -vT git@github.com
gives
OpenSSH_7.4p1,OpenSSL 1.0.2k-fips 于2017年1月26日发布。
debug1: 正在读取/etc/ssh/ssh_config配置文件
debug1: /etc/ssh/ssh_config文件第58行:应用所有选项*
debug1: 正在连接到github.com[192.30.253.112]的22端口。
debug1: 连接已建立。
debug1: 永久设置uid:0/0
debug1: 公钥未找到文件或目录
debug1: identity file /root/.ssh/id_rsa type -1
debug1: 公钥未找到文件或目录
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: 公钥未找到文件或目录
debug1: identity file /root/.ssh/id_dsa type -1
debug1: 公钥未找到文件或目录
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: 公钥未找到文件或目录
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: 公钥未找到文件或目录
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: 公钥未找到文件或目录
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: 公钥未找到文件或目录
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: 为协议2.0启用兼容模式
debug1: 本地版本字符串SSH-2.0-OpenSSH_7.4
debug1: 远程协议版本2.0,远程软件版本babeld-9db747ba
debug1: 没有找到匹配项:babeld-9db747ba
debug1: 正在作为“git”进行身份验证
debug1: SSH2_MSG_KEXINIT已发送
debug1: SSH2_MSG_KEXINIT已接收
debug1: kex: 算法:curve25519-sha256@libssh.org
debug1: kex: 主机密钥算法:rsa-sha2-512
debug1: kex: 服务器->客户端加密:chacha20-poly1305@openssh.com MAC: 压缩:无
debug1: kex: 客户端->服务器加密:chacha20-poly1305@openssh.com MAC: 压缩:无
debug1: kex: curve25519-sha256@libssh.org need=64 dh_need=64
debug1: kex: curve25519-sha256@libssh.org need=64 dh_need=64
debug1: 预计SSH2_MSG_KEX_ECDH_REPLY
debug1: 服务器主机密钥:ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: 主机“github.com”已知且匹配RSA主机密钥。
debug1: 在/root/.ssh/known_hosts中找到密钥的索引:1
警告:已将IP地址“192.30.253.112”的RSA主机密钥永久添加到已知主机列表中。
debug1: 134217728块后重新生成密钥
debug1: SSH2_MSG_NEWKEYS已发送
debug1: 预期SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS已接收
debug1: 134217728块后重新生成密钥
debug1: SSH2_MSG_EXT_INFO已接收
debug1: kex_input_ext_info: server-sig-algs=
debug1: 已接收SSH2_MSG_SERVICE_ACCEPT
debug1: 可以继续进行身份验证的方法:publickey
cat /root/.ssh/id_rsa.pub
的输出添加到Github上的SSH密钥中。 - matthias