Error when adding SSH Permissions keys on macOS Mojave

We have discovered an issue where adding an SSH key via the Project SettingsSSH Permissions menu will fail with the following error when the SSH key has been generated via ssh-keygen with the default settings on macOS Mojave:

It looks like this private key is invalid.
Please check if you have pasted the right key.

This happens because CircleCI currently doesn’t support OpenSSH-style keys. Please generate a PEM key with the following command instead:

ssh-keygen -t rsa -b 4096 -m PEM

Thanks to the author of the answer here and the author of the idea here for the workaround.

1 Like