GitHub Setup
1. Create a SSH Key-Pair
Open a terminal and start the interactive generation of a new SSH key-pair.
Set your name (one single string without blanks) instead of alice
in the following:
NAME=alice ssh-keygen -f /tmp/id_$NAME
The program ssh-keygen
will ask for a passphrase twice.
Type a passphrase of your choice and remember it: you will have to type it
quite often during the school. IMPORTANT: Do not leave
the passphrase empty! If the generation is successful,
you will see something like this:
ssh-keygen -f /tmp/id_alice Generating public/private rsa key pair. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /tmp/id_alice Your public key has been saved in /tmp/id_alice.pub The key fingerprint is: SHA256:RJz6ek6B7z4QbUAYT0E1lbdVftsrA1khs/KUEUGxu5A student@aspp The key’s randomart image is: +---[RSA 3072]----+ | .==++ooX+. ..| | .o..o.. O o. | | .+.. * + o| | ooo = = +| | .+SE = ..| | ..... o .| | oo . o . | | .oo o | | ++. | +----[SHA256]-----+
This will have generated two files, one for the private key /tmp/id_alice
and one for the public key /tmp/id_alice.pub
.
2. Save the Public Key into the System’s clipboard
While still in the terminal, let save the public key into the system's
clipboard so that we can re-use it later on GitHub. Type the following, of course using your own name and do not forget the .pub
extension:
xclip -selection c /tmp/id_$NAME.pub
The contents of that file are now in the clipboard.
3. Upload the Public Key to your GitHub account
- Now you want to make your public key known to GitHub, so it can be used during the school for easy authentication on GitHub. Login to GitHub: https://github.com/login
- After login, click on your avatar on the top right of the page and in the resulting menu select
Settings
:
- This will bring you to the profile settings page on https://github.com/settings/profile . Here from the navigation sidebar on the left select
SSH and GPG keys
:
- This will bring you to https://github.com/settings/keys . Here press the green button on the right labeled
New SSH key
:
- This will bring you to https://github.com/settings/ssh/new . Here set the title to
ASPP
. Leave theKey type
to the defaultAuthentication key
. Paste the public key you have saved in the system's clipboard into theKey
field on this page by pressingCtrl-V
:
- When you are done, press the
Add SSH Key
green button right below.
You can now verify that your key has been added on the same page https://github.com/settings/keys :
4. Store the SSH Key-Pair on the USB-Stick
- Insert your USB-stick
- The USB-stick will be automatically mounted in the directory
/run/media/student/ASPPXX
, whereXX
is the number of your stick - With the following command you will move the SSH-keys to the USB-stick:
NUMBER=XX mv /tmp/id_$NAME* /run/media/student/ASPP$NUMBER/
5. Verify GitHub Authentication with SSH-key
- Eject the USB-stick from the file manager and insert it again: a pop-up will ask you for the passphrase to unlock the private SSH key you just created
- Open a terminal and try the following:
ssh -T git@github.com
If after that you get something along these lines:
Hi Alice! You've successfully authenticated, but GitHub does not provide shell access
everything went well. If you instead get something like:
git@github.com: Permission denied (publickey)
something went wrong.