Отказано в доступе (publickey) при попытке клонировать репозиторий EC2 с локального ПК - PullRequest
0 голосов
/ 28 января 2020

Я пытаюсь клонировать репозиторий git, который я настроил на своем экземпляре Ubuntu EC2.

git clone ssh://ubuntu@test.myurl.com/var/git/testcase.git Он запускается на моем локальном windows компьютере.

Это приводит к ошибке Permission denied (publickey). Could not read from remote repository.

Я не могу понять, почему это не работает. Я уже использовал ssh-add C:\Users\Username\Docouments\MyKey.PEM Этот файл PEM не должен быть проблемой, потому что я могу S SH на сервер через Putty с тем же файлом PEM.

EDIT

Результат выполнения 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).

1 Ответ

1 голос
/ 28 января 2020

Попробуйте это в вашем ~/.ssh/config:

Host test.myurl.com
    IdentityFile C:\Users\Username\Docouments\MyKey.PEM
    User ubuntu
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...