Step 3: Copy SSH key to server
Now that we have a key, we can transfer it to our server.
This can be done with ssh-copy-id.
Run: ssh-copy-id <user>@<hostname> and it should just work(TM).
If this didn't work, you can manually add the key yourself.
Print the key in your terminal and copy it: cat ~/.ssh/id_ed25519.pub.
Connect to your server: ssh <user>@<hostname.
Edit the authorized-keys file: nano ~/.ssh/authorized_keys.
Paste what you copied earlier.
Save and exit.
Logout of the server and try logging in again. It should not ask for a password.