# Check for an existing SSH key
ls -al ~/.ssh
# If you don't see any output or that directory doesn't exist (you get a No such file or directory message), then run:
mkdir $HOME/.ssh
# Then generate a new set of keys with
ssh-keygen -t rsa -b 4096 -C your@email.com
# Add your SSH key to ssh-agent
# First, make sure that ssh-agent is running with:
eval "$(ssh-agent -s)" # for Mac and Linux
# or:
eval `ssh-agent -s`
ssh-agent -s # for Windows
# Then, add your private key to ssh-agent with:
ssh-add ~/.ssh/id_rsa
# Copy your public SSH key
cat ~/.ssh/id_rsa.pub # Linux
# Or for Windows, simply run:
clip < ~/.ssh/id_rsa.pub # Windows
# Add your public SSH key to GitHub
# Go to your GitHub settings page and click the "New SSH key" button:
# Then give your key a recognizable title and paste in your public (id_rsa.pub) key
# Finally, test your authentication with:
ssh -T git@github.com
# If you've followed all of these steps correctly, you should see this message:
# Hi your_user_name! You've successfully authenticated, but GitHub does not provide shell
# Add custom ssh-key
git config --local core.sshCommand "/usr/bin/ssh -i /home/me/.ssh/id_rsa_foo"