Generate Keys

# use ssh-keygen to generate your rsa keys and save to id_test
ssh-keygen

Copy the public key

# copy the contents of your public key to the clip-board (macOS)
cat id_test.pub | pbcopy

Install locally

ssh-add id_test

Install on remote machine

If you connect to the remote machine using VNC then do so.

# install the public key
cd ~
mkdir .ssh
cd .ssh
# create file authorized_keys
touch authorized_keys
# copy the contents of public key to the file
cat id_test.pub >> authorized_keys

Connect

ssh -i id_test root@ip_or_host