Establish SSH Connection between Local Git & GitHub

Call it personal preference but I prefer to connect to GitHub via SSH instead of HTTPS.  If there are others out there that prefer this method I thought I would take the time to write a quick how to article on making an SSH connection from your local Git to your GitHub account.

Before creating an SSH key, install Git for Windows so Git Bash and the SSH tools are available locally.

Step by step process

Screenshot from the Configure SSH Between Local Git and GitHub walkthrough at step 1, showing Is: cannot access '/c/Users; the adjacent article text explains that $ ls -al ~/.ssh.

$ ls -al ~/.ssh

Check to see if you already have an SSH key

Screenshot from the Configure SSH Between Local Git and GitHub walkthrough at step 2, showing S ssh-keygen -t rsa -b 4096 -C; the step instructs the user to check to see if you already have an SSH key.

$ ssh-keygen -t rsa -b 4096 -C “Username that appears in green”

Generates SSH key

Screenshot from the Configure SSH Between Local Git and GitHub walkthrough at step 3, showing s eval $(ssh-agent -s; the adjacent article text explains that $eval $(ssh-agent -s).

$eval $(ssh-agent -s)

Confirm SSH agent is running

Screenshot from the Configure SSH Between Local Git and GitHub walkthrough at step 4; the adjacent article text explains that confirm SSH agent is running.

$ssh-add ~/.ssh/id_rsa

Add the ssh key to agent

Next we need to let github know about our key

Screenshot from the Configure SSH Between Local Git and GitHub walkthrough at step 5; the step instructs the user to add the ssh key to agent.
Screenshot from the Configure SSH Between Local Git and GitHub walkthrough at step 6, showing Search .ssh; the step instructs the user to open id_rsa in notepad.

Open id_rsa in notepad

Screenshot from the Configure SSH Between Local Git and GitHub walkthrough at step 7; the step instructs the user to open id_rsa in notepad.

Kee this handy

Screenshot from the Configure SSH Between Local Git and GitHub walkthrough at step 8; the step instructs the user to go to github and go to your settings.

Go to github and go to your settings

Screenshot from the Configure SSH Between Local Git and GitHub walkthrough at step 9, showing Personal settings; the step instructs the user to go to github and go to your settings.

New SSH keys

Screenshot from the Configure SSH Between Local Git and GitHub walkthrough at step 10, showing SSH keys / Add new; the step instructs the user to go to github and go to your settings.
Screenshot from the Configure SSH Between Local Git and GitHub walkthrough at step 11, showing SSH keys; the step instructs the user to go to github and go to your settings.

Finally we need to verify communication between local machine and github

Screenshot from the Configure SSH Between Local Git and GitHub walkthrough at step 12, showing IS ssh -T gitegithub. com; the adjacent article text explains that finally we need to verify communication between local machine and github.

$ ssh -T git@github.com

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

Allows you to connect via SSH

Summary:
As you can see it takes a little work flipping between Git and GitHub but the work pays off in the long run.  As always, I hope y’all found this helpful.

Continue reading

Create a Repository in GitHub

Explore another guide in this topic and build on what you have just read. Read the article

Leave a Comment