ssh-keygen -t rsa -b 4096 -C "firstname.lastname@example.org"
When asked to give your key a name I recommend naming it after the service you are using it for, so for me this will be
~/.ssh/config with the following content
Host github.com HostName github.com User git IdentityFile ~/.ssh/github
Add the contents of the public key file (
~/.ssh/github.pub) to your GitHub account https://github.com/settings/keys
Done! Now you don't have to specify which SSH key you want to use when using SSH to interface with GitHub.
This is how I do it.
Bonus: If you use multiple accounts you can do this in your config:
# account myfirstaccount (username) Host github.com-myfirstaccount HostName github.com User git IdentityFile ~/.ssh/github-myfirstaccount # account mysecondaccount Host github.com-mysecondaccount HostName github.com User git IdentityFile ~/.ssh/github-mysecondaccount