2

I followed this article on github on how to generate ssh key but it keeps asking for a passphrase, but I haven't set up one! Even if I set up a passphrase it ignores it and asks for it again. It claims that it uses the right key that I set up but in the end I get permission denied.

Details of my key set up:

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

Then, I choose default location ~/.ssh/id_rsa and run clip < ~/.ssh/id_rsa.pub.

Then paste it on my github account in SSH settings. Also, I add the following line to my ssh config (~/.ssh/config):

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

So far so good. Let's test it now!

'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':

But there is no passphrase set up! I click enter and I get:

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

Ok, let's give it another go, it asks for passphrase again :( :

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

Just for completeness, setting up a passphrase doesn't solve anything:

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

Any ideas why it doesn't work? :(

  • Permissions of all files in ~/.ssh/ are 600. – eddyP23 Feb 20 '16 at 16:05
  • The funny thing is that GitHub thinks that my SSH key has been used (you can see it in settings), but it never worked! – eddyP23 Feb 20 '16 at 16:39
2

You have the config wrong. You need to provide the private key and not the public to the option IdentityFile (without the pub extension):

Host github.com
    IdentityFile ~/.ssh/id_rsa
  • You are my hero, Jakuje! (very frustrated that it didn't give me a better error message) – eddyP23 Feb 20 '16 at 17:08
  • Yes, the message is bad and I work on fixing that, but it is run on the long distances with upstream. – Jakuje Feb 20 '16 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.