Supplemental GitHub instructions

There is a configuration issue with the git installation on ECN machines, which can make it tricky to clone your repository. There are two possible workarounds until the issue gets resolved:

Option 1: Using an SSH Key Pair

This is the preferred workaround, and, indeed, can be used at all times. Once you have this set up, you will never have to enter your username or password when accessing GitHub from your ECN account.

SSH Keys

Normally when you use SSH, you have to enter your password. However, SSH has an alternate mode of authentication that uses public/private key pairs. You generate a private encryption key that you keep stored in your ECN account (no one but you can use it), and give your public key (that anyone can see) to servers that you want to SSH to. When you SSH to that server, your private key will be matched up with your public key to give you access.

Generate your public/private key pair

If you have not already generated a key pair for your ECN account, the following procedure will generate a key pair in ~/.ssh/. First, run the command:

> ssh-keygen

Hit enter three times (to accept the default location, then to set and confirm an empty passphrase). This will create two files: ~/.ssh/id_rsa (your private key) and ~/.ssh/id_rsa.pub (your public key)

Copy your public key to GitHub

First, print out your public key:

> cat ~/.ssh/id_rsa.pub

Copy the result to the clipboard. Then follow steps 2–8 here.

Use SSH to access your GitHub repos instead of HTTPS

The various GitHub instructions for the course tell you to access GitHub repos using URLs that look like https://github.com/<path to git repo here>. This will access GitHub using HTTPS. To access GitHub using SSH instead, use URLs that look like git@github.com:<path to git repo here> (It seems weird to have that git@github.com bit in there, but it's necessary.)

For example, PA01 tells you to clone your repository like this:

> git clone https://github.com/ECE264/PA01-<your username here> PA01

Instead, to use SSH, you would clone your repository like this:

> git clone git@github.com:/ECE264/PA01-<your username here> PA01

Note: if you go to the webpage for your GitHub repo and click the "Clone or download" button, there will be a link in the upper right hand corner named "Use SSH." Clicking that link will generate the SSH URL you need for your repository.

Option 2: Changing your ECN environment

This approach is a little bit "easier," because you will keep using HTTPS and do not have to mess with generating SSH keypairs, but you will have to change your ECN environment. Unless you edit your .bashrc file, you will have to do this every time you log in to an ECN machine.

Change your environment

Unset the SSH_ASKPASS environment variable:

> unset SSH_ASKPASS

Add your GitHub username to GitHub URLs

You will need to tell GitHub what your username is whenever you try to access a GitHub URL. You can do this by including your username in the URL. Instead of using URLs that look like https://github.com/<path to git repo here>, you will use URLs that look like https://<your username here>@github.com/<path to git repo here>. So, for example, PA01 tells you to clone your repository like this:

> git clone https://github.com/ECE264/PA01-<your username here> PA01

Instead, to use SSH, you would clone your repository like this:

> git clone https://<your username here>@github.com/ECE264/PA01-<your username here> PA01