SSH is the secure shell program for connecting to remote servers. It’s also used as a transport mechanism for Git and many other tools. Part of how SSH works is based on public key cryptography, in which you have a private key accessible only to you, and a corresponding public key that you can share with anyone.
In the finder, go to the Applications » Utilities folder, and open the Terminal application.
At the terminal prompt ($
), type the following command and press enter:
ssh-keygen
It should produce output like the following. You will have to press enter three more times: once to use the default file name, and twice to enter an empty passphrase. Your fingerprint and ID will differ from mine, of course.
Now we need to tell git who you are. It will tag each change you commit with your name and email address. Enter these two commands at the terminal prompt, substituting your actual name and email between the quotes:
git config --global user.name "YOUR FULL NAME"
git config --global user.email "YOUR EMAIL ADDRESS"
Finally, type the following command at the bash prompt:
open -e .ssh/id_rsa.pub
The editor window will contain ssh-rsa
followed by a long code. This is your public key. Select all (⌘-A), then copy (⌘-C).
The next step depends on which course or project you are taking.
If we are using my git@liucs.net
server, just paste the key into an email to , along with your course number and name. You’ll have to wait for a response from me before using your git account.
If we are using GitHub, log in to https://github.com/
in your browser and select Account Settings in the upper right. Then, in the section SSH Keys, you’ll find a button Add SSH key. Paste your public key into the Key section, and give it whatever title you want. Push the green button to accept.