2018-09-07 SSH Keys

posted Sep 7, 2018, 6:16 AM by Konstantinovich Samuel   [ updated Sep 12, 2018, 6:06 AM ]
2 - Set up git at home.
  • download git here https://git-scm.com/download/
  • Mac/Linux users can do the same steps that we did in class by opening a regular terminal.
  • Windows users should run git-bash (it comes with your download) This is a shell that has the commands you need. This includes the SSH keygen ability we worked on in class.

Goal: Add SSH keys to your git accounts.

Resource - git cheat sheet:


Make sure your network settings are set up properly! (stuycs labs)

-Click settings (gearbox icon)

-Click network

-Click Network Proxy -> manual ->

enter the two values in ALL 4 lines:

Address                 Port 3128

2. GIT Configuration

0b. Configure your local git (on every computer you use!)

(use your name and your git related email)

git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

git config --global core.editor EDITORNAME

where the EDITORNAME is the editor you want:

atom (I will use in class)

nano (most basic - use this for now)





  1. Open Terminal. (ctrl + alt + T)

  2. Paste the text below, substituting in your GitHub email address.

ssh-keygen -t rsa -b 4096 -C "StuyCS Lab email@whatever.com"

This creates a new ssh key, using the provided email as a label. Note that the -C is a comment, so any text will work, but this kind of comment helps manage keys

  1. When you're prompted:

Enter a file in which to save the key (/home/you/.ssh/id_rsa): [Press enter]

Press Enter. This accepts the default file location.

  1. At the prompt, type a pasphrase (twice) the shell will NOT SHOW YOU TYPING. This is desired behavior so you cannot see how many letters it is.

4. Add ssh key to github.

This key can be used to authenticate on github or other computers. For now you just need to add it to github.

  1. Open id_rsa.pub using a text editor.
  2. Log into your git account
  3. In the upper-right corner of any page, click your profile photo, then click Settings.
  4. In the user settings sidebar, click SSH and GPG keys.
  5. Click New SSH key or Add SSH key.
  6. Paste your key into the "Key" field.And add a label to the "Title" field (e.g. Stuy cs lab
  7. Click "Add SSH key" and possibly, confirm your git password.
  8. TO TEST YOUR KEYS - Enter the following:

    ssh -T git@github.com
    #it should successfully authenticate and say you don't get a shell with github.
6. Verify you can do it!

- Create a repository on the github website.

- Since theis is the first time using this repo on this machine you need to Clone the repository on your local machine.
*IMPORTANT* use the ssh link found on the repo.
    git clone LINK_FROM_REPO
(future times using the repo you will just git pull, since it has already been cloned)

-Change files, save them.

-Commit your changes by adding and commiting.

-Push your changes... then check the repo on the website to verify that it worked.