Generating a new SSH key pair
To create a new SSH key pair:
1) Open a terminal
2) Generate a new SSH key pair:
ssh-keygen -o -t rsa -b 4096
3) Next, you will be prompted to input a file path to save your SSH key pair to. If you don’t already have an SSH key pair, use the suggested path by pressing <enter>.
4) Once the path is decided, you will be prompted to input a password to secure your new SSH key pair. It’s a best practice to use a password, but it’s not required and you can skip creating it by pressing <enter> twice.
Extra options:
The -C flag adds a comment in the key and it is optional:
ssh-keygen -o -t rsa -b 4096 -C "www@server.example.net"
To add or change the password of your SSH key pair:
ssh-keygen -p -o -f ~/.ssh/id_rsa