To create an SSH key locally:
cd ~/.ssh
# Creates a new pair of SSH keys using elliptic curve called ed25519
# You will have to prompt the path to save the key and a passphrase
ssh-keygen -t ed25519
# Creates a new file called config that will store information about the key and who will access it
# You can use an editor at your choice
nano config
In config file, write the following content:
Host github.com
HostName github.com
User git
IdentityFile $PATH
$PATH
is the path where we saved the key.
For instance, $PATH
= ~/.ssh/id_github
Close the file. Fetch the content of the generated public key with the following command:
# Fetch the content of public key generated. id_github is the name of the key
cat $KEYNAME.pub
$KEYNAME
is the name of the key.
For instance, $KEYNAME
= id_github given the path above in IdentityFile
attribute of config
file.
In the end, add the public key (it is the output of cat
command) here.