Easy GitHub SSH Setup

onestop_databy:

Github

GitHub SSH setup is one of the things that you do once every time you get a new computer or gain access to a new server. This tutorial shows how to configure GitHub on your local machine using the command line.

If it is your first time using GitHub on your computer, the first thing you need to do is to download it and tell GitHub which computer you are using access GitHub data a.k.a upload your SSH key(s) to Git.

1. GitHub Generate SSH Key

Before starting the GitHub SSH setup, I’m assuming that you already have a git account and it is also installed on your computer (you can check by typing which git)

If this is the case, the next step is to set up your Github account locally:

$ git config --global user.name "YOUR_USER_NAME"
$ git config --global user.email "your_email@domain.com"

Next, you should generate an SSH key if you have not yet. You can do it by checking if the files ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub exist.

If not, you can run the following command to generate it:

$ ssh-keygen -t rsa -C "your_email@domain.com"

Now that you have generated the SSH key, it should be copied and uploaded to git. Using the command below, you can copy the key:

$ pbcopy < ~/.ssh/id_rsa.pub

2. Uploading SSH Key Into GitHub

Finally, you should upload the key to git following these steps:

Access your git account settings and follow these steps below

One last check, back on the computer terminal, when you type:

$ ssh -T git@github.com

You should receive a happy message such as this:

Hi YOUR_USER_NAME! You've successfully authenticated, but Github does
not provide shell access.

I hope this tutorial helped and you do not have to deal with configuring Github any time soon 🙂

More Resources

Here are three of my favorite GitHub Books in case you want to learn more about it.

Related Posts