【发布时间】:2019-06-26 22:12:39
【问题描述】:
我正在尝试在我的项目中通过 ssh 而不是 hhtps 访问 git。我按照这个步骤here 并添加了 ssh 密钥。我在日志中收到以下错误。
Failed to add the RSA host key for IP address 'xxx' to the list of known hosts (/home/webapp/.ssh/known_hosts).
我将所有权从 ec2-user 更改为 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
给了
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: Permanent_set_uid: 0/0
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件 /root/.ssh/id_rsa 类型 -1
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件 /root/.ssh/id_rsa-cert type -1
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件 /root/.ssh/id_dsa 类型 -1
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件 /root/.ssh/id_dsa-cert type -1
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件 /root/.ssh/id_ecdsa 类型 -1
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件 /root/.ssh/id_ecdsa-cert type -1
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件 /root/.ssh/id_ed25519 类型 -1
debug1:key_load_public:没有这样的文件或目录
debug1:身份文件 /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”身份向 github.com:22 进行身份验证
调试 1:已发送 SSH2_MSG_KEXINIT
调试 1:收到 SSH2_MSG_KEXINIT
调试1:kex:算法:curve25519-sha256@libssh.org
debug1:kex:主机密钥算法:rsa-sha2-512
调试1:kex:服务器->客户端密码:chacha20-poly1305@openssh.com MAC:压缩:无
调试1:kex:客户端->服务器密码:chacha20-poly1305@openssh.com MAC:压缩:无
调试1:kex:curve25519-sha256@libssh.org需要=64 dh_need=64
调试1:kex:curve25519-sha256@libssh.org需要=64 dh_need=64
调试 1:期待 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 个块后重新生成密钥
调试 1:收到 SSH2_MSG_EXT_INFO
debug1: kex_input_ext_info: server-sig-algs=
调试 1:收到 SSH2_MSG_SERVICE_ACCEPT
debug1:可以继续的身份验证:publickey
debug1:下一个认证方法:publickey
debug1:尝试私钥:/root/.ssh/id_rsa
debug1:尝试私钥:/root/.ssh/id_dsa
debug1:尝试私钥:/root/.ssh/id_ecdsa
debug1:尝试私钥:/root/.ssh/id_ed25519
debug1:没有更多的身份验证方法可以尝试。
权限被拒绝(公钥)。
请帮忙解决。
【问题讨论】:
-
你做最后一步了吗? help.github.com/articles/… 例如,您可以将
cat /root/.ssh/id_rsa.pub的输出添加到您在 Github 上的 SSH 密钥中。
标签: ruby-on-rails git amazon-web-services github amazon-elastic-beanstalk