SSH para o github usando o CygWin não funciona

1

Eu segui este artigo no github sobre como gerar ssh key, mas continua pedindo uma senha, mas eu não configurei nenhuma! Mesmo se eu definir uma senha, ignora e pede novamente. Ele afirma que usa a chave certa que eu configurei, mas no final eu recebo permissão negada.

Detalhes da configuração da minha chave:

ssh-keygen -t rsa -b 4096 -C "[email protected]"

Em seguida, escolho a localização padrão ~/.ssh/id_rsa e executo clip < ~/.ssh/id_rsa.pub .

Em seguida, cole-o na minha conta do github nas configurações do SSH. Além disso, adiciono a seguinte linha à minha configuração ssh ( ~/.ssh/config ):

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

Até aí tudo bem. Vamos testar agora!

'ssh [email protected] -Tv' give the following output:

$ ssh -vT [email protected]
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 [email protected] <implicit> none
debug1: kex: client->server [email protected] <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':

Mas não há senha definida! Eu clico em entrar e fico:

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

Ok, vamos dar outra chance, ele pede uma senha novamente :(:

$ git push -u origin master -v
Pushing to [email protected]: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.

Apenas para completar, configurar uma senha não resolve nada:

$ 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.

Alguma idéia de por que não funciona? : (

    
por eddyP23 20.02.2016 / 17:02

1 resposta

2

Você tem a configuração errada. Você precisa fornecer a chave privada e não o público para a opção IdentityFile (sem a extensão pub ):

Host github.com
    IdentityFile ~/.ssh/id_rsa
    
por 20.02.2016 / 17:52