1

Я следил за этой статьей на github о том, как сгенерировать ключ ssh, но он постоянно запрашивает парольную фразу, но я ее не создал! Даже если я настрою парольную фразу, она игнорирует ее и просит снова. Он утверждает, что использует правильный ключ, который я настроил, но в конце концов я получаю разрешение на отказ.

Детали настройки моего ключа:

ssh-keygen -t rsa -b 4096 -C "name.surname@gmail.com"

Затем я выбираю местоположение по умолчанию ~/.ssh/id_rsa и запускаю clip < ~/.ssh/id_rsa.pub .

Затем вставьте его в мою учетную запись github в настройках SSH. Также я добавляю следующую строку в мою конфигурацию ssh (~/.ssh/config):

Host github.com
    IdentityFile ~/.ssh/id_rsa.pub

Все идет нормально. Давайте проверим это сейчас!

'ssh git@github.com -Tv' give the following output:

$ ssh -vT git@github.com
OpenSSH_7.1p2, OpenSSL 1.0.2f  28 Jan 2016
debug1: Reading configuration data ~/.ssh/config
debug1: ~/.ssh/config line 1: Applying options for github.com
debug1: Connecting to github.com [192.30.252.128] port 22.
debug1: Connection established.
debug1: identity file ~/.ssh/id_rsa.pub type 1
debug1: key_load_public: No such file or directory
debug1: identity file ~/.ssh/id_rsa.pub-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: Authenticating to github.com: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: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in ~/.ssh/known_hosts:1
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: ~/.ssh/id_rsa.pub
debug1: Server accepts key: pkalg ssh-rsa blen 279
Enter passphrase for key '~/.ssh/id_rsa.pub':

Но пароль не настроен! Я нажимаю Enter и получаю:

debug1: No more authentication methods to try.
Permission denied (publickey).

Хорошо, давайте попробуем еще раз, он снова просит фразу :(:

$ git push -u origin master -v
Pushing to git@github.com:myUserName/myRepo.git
Enter passphrase for key '~/.ssh/id_rsa.pub':
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Просто для полноты, установка парольной фразы ничего не решает:

$ ssh-keygen -f id_rsa -p
Enter new passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved with the new passphrase.

Есть идеи, почему это не работает? :(

1 ответ1

2

У вас неверный конфиг. Вам необходимо предоставить закрытый ключ, а не открытый, для опции IdentityFile (без расширения pub ):

Host github.com
    IdentityFile ~/.ssh/id_rsa

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .