Github SSH Login
First generate a ssh key
ssh-keygen -t ed25519 -C "your_email@example.com"
What if i added passphrase to my SSH key?
Start ssh-agent and register key
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
This will keep the key in memory until next reboot/session so you can use the key without password until next reboot/session
What if i didn't keep the default "id_ed25519" name?
You can configure SSH to use other keys from “~/.ssh/config” file
# Create file if doesn't exist already
cd ~/.ssh
touch config
sudo chmod 644 config
# Open file in editor
nano config
and then add this in the file
Host github.com
IdentityFile ~/.ssh/<keyname>
Copy the public key and add it on Github
cat ~/.ssh/id_ed25519.pub
Thats it! You are now authenticated on GitHub using your SSH key.
GitHub Commit Signing Using SSH
To use the same SSH key for signing commits on GitHub you need to re-add the key on Github but this time change “Key type” to “Signing Key” and then run
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519
and now you can use -S to sign commit
git commit -m "misc changes" -S
or you can setup auto signing
git config --global commit.gpgsign true