Key is invalid. You must supply a key in OpenSSH public key format error message

I´ve been working my way through the documentation for connecting with SSH key starting at:
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/checking-for-existing-ssh-keys

However, when I try to add my new SSH key I get the following error message:
Key is invalid. You must supply a key in OpenSSH public key format

I´ve read a few earlier posts about this problem, and saw in one of them that the length should be 68 without the email. Mine is 50 characters long without the email. With the email included, it´s 67. The key starts with SHA256 and ends with my email address (with a lot of random signs in between.

I´m doing this on an iMac, and I few days ago I did it on my Macbook (and it went smoothly). However, in the meantime I´ve installed the newest version of MacOs on my iMac (Monterey, version 12.0.1). Could this somehow have screwed things up? Any tips would be fantastic!

That sounds like you’re trying to use the fingerprint instead of the public key. With OpenSSH the public key should be in a file with a name ending in .pub, and the content should start with ssh-, followed by the key type (e.g. rsa or ed25519).

1 Like

Thanks a lot @airtower-luna ! Made my day :smile:

1 Like