Ssh Github On Macbook

#devops
  1. Install git
brew install git
git --version
  1. Configure Git
git config --global user.name "himanshu864"
git config --global user.email "himanshu864000@gmail.com"
  1. Check for existing SSH Keys
ls -al ~/.ssh

Look for files named id_rsa and id_rsa.pub. If exists, you already have an SSH key. Hence, skip 4th step.

  1. Generate new SSH keys
ssh-keygen -t rsa -b 4096 -C "himanshu864000@gmail.com"
  1. Add SSH Key to SSH Agent
eval "$(ssh-agent -s)"

ssh-add --apple-use-keychain ~/.ssh/id_rsa
  1. Add SSH Key to GitHub Account
# copy public key to clipboard
pbcopy < ~/.ssh/id_rsa.pub

And paste it to GitHub Browser > Settings > SSH and GPG keys > New SSH Key

  1. Test SSH Connection
ssh -T git@github.com

type yes and enter to get the following message if successful

Hi himanshu864, You've successfully authenticated, but GitHub does not provide shell access.

  1. Clone Repositories and Try Pushing changes!

And you're done!

On this page