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
- 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 firstname.lastname@example.org. 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.
To generate SSH key files without prompt, use:
ssh-keygen -t rsa -b 4096 -C "your_comment" -f ~/.ssh/id_rsa -N "passphase"