PhpStorm – “Keypair is corrupt or has unknown format”

PhpStorm (as of version 2019.1) does not like macOS generated private keys. If you generate your key like this on macOS Mojave:

ssh-keygen -t rsa -b 4096 -f id_rsa -C "my key"

PhpStorm, when trying to use sftp to connect to a remote dev server will tell you the keypair is corrupt or has unknown format bla, bla, bla.

The solution is to remote (ssh) into your linux dev server and generate the key pair there using the exact same command. Then copy (scp) that file to your local machine and point PhpStorm at that private key. You’ll see success once you update the public key on the remote server in the proper location.