Copy ssh GPG keys from Windows to a remote Linux machine

Copy ssh GPG keys from Windows to a remote Linux machine

In Linux you have ssh-copy-id which is quick and useful:

ssh-copy-id [email protected]

But how do you copy you ssh keys from your Windows machine to a remote Linux machine? It's a bit more convoluted but you can use:

type .ssh\keyfile.pub | ssh [email protected] "cat >> .ssh/authorized_keys"

If it's the first key you add the authorized_keys file and the .ssh folder will be missing so you can use this instead:

type .ssh\keyfile.pub | ssh [email protected] "mkdir .ssh && touch .ssh/authorized_keys && cat >> .ssh/authorized_keys"