[英]Permission denied (publickey) when trying to clone EC2 repository from local PC
I am trying to clone a git repository that I have setup on my ubuntu EC2 instance.我正在尝试克隆我在 ubuntu EC2 实例上设置的 git 存储库。
git clone ssh://ubuntu@test.myurl.com/var/git/testcase.git
This is run on my local windows computer. git clone ssh://ubuntu@test.myurl.com/var/git/testcase.git
这是在我的本地 Windows 计算机上运行的。
It results in the error Permission denied (publickey). Could not read from remote repository.
它导致错误
Permission denied (publickey). Could not read from remote repository.
Permission denied (publickey). Could not read from remote repository.
I am unable ot understand why this is not working.我无法理解为什么这不起作用。 I already used
ssh-add C:\\Users\\Username\\Docouments\\MyKey.PEM
This PEM file shouldn't be the problem because I can SSH into the server via Putty with that same PEM file.我已经使用了
ssh-add C:\\Users\\Username\\Docouments\\MyKey.PEM
这个 PEM 文件应该不是问题,因为我可以使用相同的 PEM 文件通过 Putty SSH 进入服务器。
EDIT编辑
Result of running ssh -v ubuntu@test.myurl.com
运行
ssh -v ubuntu@test.myurl.com
结果
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to test.myurl.com [51.**.***.166] port 22. debug1: Connection established. debug1: identity file /home/ubuntu/.ssh/id_rsa type -1 debug1: identity file /home/ubuntu/.ssh/id_rsa-cert type -1 debug1: identity file /home/ubuntu/.ssh/id_dsa type -1 debug1: identity file /home/ubuntu/.ssh/id_dsa-cert type -1 debug1: identity file /home/ubuntu/.ssh/id_ecdsa type -1 debug1: identity file /home/ubuntu/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/ubuntu/.ssh/id_ed25519 type -1 debug1: identity file /home/ubuntu/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4 debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4 debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4 pat OpenSSH_6.6.1* compat 0x04000000 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none debug1: sending SSH2_MSG_KEX_ECDH_INIT debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ECDSA 8d:3c:a9:08:a3:42:63:13:f8:b9:b7:bc:6e:4b:c6:44 debug1: Host 'test.myurl.com' is known and matches the ECDSA host key. debug1: Found key in /home/ubuntu/.ssh/known_hosts:1 debug1: ssh_ecdsa_verify: signature correct 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: Trying private key: /home/ubuntu/.ssh/id_rsa debug1: Trying private key: /home/ubuntu/.ssh/id_dsa debug1: Trying private key: /home/ubuntu/.ssh/id_ecdsa debug1: Trying private key: /home/ubuntu/.ssh/id_ed25519 debug1: No more authentication methods to try. Permission denied (publickey).
Try this in your ~/.ssh/config
:在你的
~/.ssh/config
试试这个:
Host test.myurl.com
IdentityFile C:\Users\Username\Docouments\MyKey.PEM
User ubuntu
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.