In this video, we'll create an account on GitHub. Then, we'll configure that account to utilize our SSH key to authenticate our local machine with the remote repository.

Creating an Account on GitHub

Before we can use GitHub, we need to create an account.

  • Go to the "Join GitHub" page
  • Fill in your information and click "Create an account"
  • Select the plan that fits your needs and click "Finish sign up"

(When you sign up, you'll receive an email to verify your email address. Go ahead and click the link in that email to complete your account setup.)

Adding Your SSH Key to Your GitHub Account

The next step to setting up a GitHub account is to add your SSH key to your account.

You can copy your ssh key by typing "less ~/.ssh/id_rsa.pub" on your local machine, then copying everything from "ssh-rsa" to the end of your email address. When you have it copied, press "q" to quit the less application.

Now that you have it copied, you need to add it to your GitHub account.

  • In the top right corner of the GitHub page, click the "gear" icon to view your settings
  • Select "SSH keys" from the sidebar.
  • Click "Add SSH key"
  • Title: Brian's MacBook Air (The title is used to differentiate your computers because you can upload SSH keys from multiple computers. ie: Work Computer, Personal Laptop, Live Server etc.)
  • Key: (Paste your key here.)
  • Click "Add key"
  • If asked to enter your GitHub password, do so.

Now, you'll see your new Key in the list. You will need to add a new key for each computer that needs to access your repositories. That would include live servers and any dev or staging servers.

Collaborators will have their own GitHub accounts and add their SSH keys to those accounts. Then, they can join one of your projects on GitHub and by doing so, all of the computers they have SSH keys for will have access to that project's repository.

Testing Your New SSH Key

Now that you have your SSH key uploaded, it's a good idea to test it to make sure that it's working before you proceed.

The process to do so is actually quite simple.

  • Open a terminal window
  • Type "ssh -T git@github.com"
  • Press Enter

Now you might see a warning like the following:

The authenticity of host 'github.com (192.30.252.128)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?

This is expected.

  • Type "yes"
  • Press Enter

Now you'll see a message like the following:

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

If the username is yours, you've successfully setup your SSH key! (Don't worry about the "shell access" statement. You won't need that.)

If you receive an "access denied" message, read the Error: Permission denied (publickey) help page.