权限被拒绝(publickey)Git和AWS EC2

时间:2016-08-07 22:49:20

标签: linux git ssh amazon-ec2

有许多类似的问题和答案与此授权问题相关 - “权限被拒绝(公钥)”。但是,它们都不能解决我的问题......

以下是我的情况:我正在使用亚马逊网络服务器EC2,我的电脑与服务器连接良好。下一步,我试图在服务器上安装git。我希望完成的结果是当我从本地推送时更新服务器端。但问题出现了:“权限被拒绝(公钥)”

OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /Users/IvyLin/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to 52.68.24.4 [52.68.24.4] port 22.
debug1: Connection established.
debug1: identity file /Users/IvyLin/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/IvyLin/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to 52.68.24.4:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:ieQEskLZ3tiW76F5KPhlQfHcGYFW+SifiIDQnBUZHmY
debug1: Host '52.68.24.4' is known and matches the ECDSA host key.
debug1: Found key in /Users/IvyLin/.ssh/known_hosts:5
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/IvyLin/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: /Users/IvyLin/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/IvyLin/.ssh/id_dsa
debug1: Trying private key: /Users/IvyLin/.ssh/id_ecdsa
debug1: Trying private key: /Users/IvyLin/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

我想知道的一件事是我应该在哪里准确地放置公钥?服务器中已有一个用于“验证服务器连接”的.ssh文件,路径:~/.ssh,它适用于我。 就git的ssh密钥而言,我在git文件夹中创建了另一个.ssh文件夹,路径:~/home/git/.ssh。在连接期间它查找哪个文件?虽然我试图将公钥放入~/.ssh,但仍然无效......

我已经被困在那里很长时间了,如果有人可以帮助我,我真的很感激!实现“更新为推动”的解决方法也将帮助我!

1 个答案:

答案 0 :(得分:0)

  

我想知道的一件事是我应该把公钥放在哪里?

您必须将公钥放在您帐户下的git服务器上。

  

在连接期间查找哪个文件?

您必须将~/.ssh/id_rsa.pub复制到您的git服务器帐户