New ssh key:

ssh-keygen -t ed25519 -C "some remark to identify key"

There are few questions about where to store file, passphrase etc.

Copy ssh key to server:

ssh-copy-id -i /home/bob/.ssh/key_xxx.pub -p 1234 bob@bobsserver.com

-i stands for identity file, -p for port for server to which ssh key is copied. There are some info printed where key is to be copied and prompt to enter password for key. It prints some instruction how to use it too - via same -i parametr is possible to attach pub key to ssh command.

Ssh allows to create config on client and use just name of config’s section in ssh command.

First let’s setup access for actual user only:

chmod 600 ~/.ssh/config 

Now sections like following one can be added to the config:

Host bobstest
    HostName bobsserver.com
    User bob
    Port 1234
    IdentityFile /home/bob/.ssh/key_xxx.pub

And this section can be used in ssh command like this:

ssh bobstest

Setup access via ssh is good secure option and play nicelly with git too. Best to use it in combination with config file on client side.