- Open your favorite terminal
- Run the ssh-keygen command
$ ssh-keygen -t rsa -b 4096 -C "email@example.com"
INFO: For increased security, the type flag
-t rsaand the bits
flag -b 4096are required. The comment flag
-C "firstname.lastname@example.org"allows us to easily identify who owns the SSH key.
- Specify the key file name. Default is
- Enter a passphrase *optional
WARNING: If you already have a default SSH key ~/.ssh/id_rsa, DO NOT OVERWRITE IT. If you are not careful, you will lose SSH access to your cloud servers and git platforms. Instead, give your new SSH key a new name, such as id_rsa_avengers.