SSH
Summary
GitHub offers easy integration with a local SSH client to access public/private repositories via SSH instead of HTTPS.
Instructions
UNIX
Create a personal key:
- Generate a new SSH key with
ssh-keygen -C email@address.com -f ~/.ssh/personal -N ""
. - Copy the output of
cat ~/.ssh/personal.pub
to GitHub and name it as your machine’s name (eg.:MacBook Pro M2
). - Append to
~/.ssh/config
:
Host personal
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/personal
- Add your identity with
ssh-add ~/.ssh/personal
. - Check if your identity has been added with
ssh-add -L
. - Authenticate with
ssh -T git@personal
. You should see your GitHub username. Authentication is necessary only once when setting up.
Notes
- While not necessary, it is generally recommended to keep separate keys for separate machines.