I used PuTTY Key Generator to generate a 4096 bit RSA-2 key with a passphrase.
I save the .ppk and an openSSL format public key. The putty format public key doesn\'t
So, after update I had the same issue. I was using PEM key_file
without extension and simply adding .pem
fixed my issue. Now the file is key_file.pem
.
If you're using Windows 10 with the built-in SSH, as of August 2020 it only supports ed25519 keys. You'll get the key_load_public: invalid format
error if you use e.g. an RSA key.
As per this GitHub issue it should be fixed via Windows Update some time in 2020. So one solution is to just wait for the update to ship.
If you can't wait, a workaround is to generate a new ed25519 key, which is good advice anyway.
> ssh-keygen -o -a 100 -t ed25519
You can use it with e.g. github, but some older systems might not support this newer format.
After generating your key, if you're using either of the below features, don't forget to update them!
~\.ssh\config
might still point to the old key.ssh-add
commandIn the case you copy your public key with clipboard and paste it, it may happen the public key string can be broken which contains new-line.
Make sure your public key string formed as one line.
The error is misleading - it says "pubkey
" while pointing to a private key file ~/.ssh/id_rsa
.
In my case, it was simply a missing public key (as I haven't restored it from a vault).
I used to skip deploying ~/.ssh/id_rsa.pub
by automated scripts.
All ssh
usages worked, but the error made me think of a possible mess.
Not at all - strace
helped to notice that the trigger was actually the *.pub
file:
strace ssh example.com
...
openat(AT_FDCWD, "/home/uvsmtid/.ssh/id_rsa.pub", O_RDONLY) = -1 ENOENT (No such file or directory)
...
write(2, "load pubkey \"/home/uvsmtid/.ssh/"..., 57) = 57
load pubkey "/home/uvsmtid/.ssh/id_rsa": invalid format
Instead of directly saving the private key Go to Conversions and Export SSh Key. Had the same issue and this worked for me
It seems that ssh
cannot read your public key. But that doesn't matter.
You upload your public key to github, but you authenticate using your private key. See e.g. the FILES section in ssh(1)
.