Connecting to GitHub with SSH

Here is the quick guide to push/pull GitHub repository via SSH connection based on the instructions on GitHub Help
- Open Git Bash
- Generate a new SSH key, use command
ssh-keygen -t rsa -b 4096 -C “your_comment_or_email”
. Enter to accept default filename and input passphase as needed. - Check if SSH is running withy command
eval $(ssh-agent -s)
. You should see output like:Agent pid 4056
- Add the new SSH private key to SSH agent with command
ssh-add ~/.ssh/id_rsa
- Copy the public key to the clipboard with command
clip < ~/.ssh/id_rsa.pub
- Go to GitHub SSH and GPG keys setting
- Click New SSH, name Title for your reference, and paste into the Key
- Click Add SSH Key
- Test connection with command
ssh -T git@github.com
. If everything works fine, you should see this message
Hi …! You’ve successfully authenticated
Now, you should be able to connect to GitHub via SSH.
Additional Tips
To generate SSH key files without prompt, use:
ssh-keygen -t rsa -b 4096 -C "your_comment" -f ~/.ssh/id_rsa -N "passphase"