Generating a new SSH key:
ssh-keygen -t ed25519 -C "your_email@example.com"NOTE: You can press enter for all prompts or configure it your way.
Add private key to the authentication agent:
ssh-addNOTE: This step is a reference to that point in the github documentation.
Check your ~/.ssh directory:
ls -lthr ~/.sshYou should see these two files:
id_ed25519.pub
id_ed25519The id_ed25519.pub is your public key, this is the key that must be defined in your Github Settings / SSH and GPG keys.
The id_ed25519 is your private key, once generated, you should not take any action on it, just keep it safe.
Once the new SSH keys are generated, you can add them to your Github account in the following ways:
Go to SSH and GPG keys in Github Settings panel:
Within the Keys panel, click in New SSH key to create a new key:
- In the
Titlefield add a name for your SSH key, I recommend something similar to this:
Github SSH Auth Key
-
In the
Key Typefield, selectAuthentication Key, which is the default value. -
In the
Keyfield, add the value of~/.ssh/id_ed25519.pub, which is something like this:
Run:
cat ~/.ssh/id_ed25519.pubPublic key output example:
ssh-ed25519 XXXXX your_email@example.comNOTE: In the Key field we always put the value of the public key, it's something a little confusing, but it's well documented.
After adding a new SSH authentication key to your account on GitHub.com, you can reconfigure any local repositories to use SSH. For more information, see Managing remote repositories.
Source:

