SSH Access

After you have set up & configured git access 🔗, every time you interact with the remote server, you will have to type in your personal access token (PAT). To streamline this interaction and avoid typing your credentials, you can follow the instructions outlined below to set up SSH keys.

Generating a new SSH key

Open a terminal and copy the command below replacing NetID with your own:

ssh-keygen -t rsa -b 4096 -C "NetID@illinois.edu"

The above command will generate a public/private key pair using the provided email as a label. You will see the following two lines in the terminal:

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

Press 'Enter' to accept the default location (unless you want to save it elsewhere) and proceed to the passphrase phase.

Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

At the prompt, either press 'Enter' twice for an empty passphrase or type in a passphrase. It is recommended that you use a passphrase but unless someone gets access to your computer or you distribute your private key, you should be okay with no passphrase. After you enter your passphrase, an identification and public key files will be saved at the previously specified locations.

Adding your SSH key to the ssh-agent

ssh-agent is a program stores your keys and communicates with SSH clients. This program will be used when you try to communicate with the Github server. To start an ssh-agent in the background, type:

eval "$(ssh-agent -s)"

Add you SSH private key to the ssh-agent (replace the path to the private key if you specified an alternative path during the generations steps)

ssh-add ~/.ssh/id_rsa

Adding your SSH key to your Github account

To add your newly generated SSH key to your Github account, navigate to Github. Click on your profile picture at the top right corner and press 'Settings' in the drop-down window. This will open the general settings page. Click on 'SSH and GPG keys' followed by the 'New SSH key' button to be shown the page below.

Give your SSH key whatever title you want. Navigate to the location of the SSH keys you generated earlier (~/.ssh/id_rsa.pub), open the file, and copy all of its contents into the 'Key' section. Click on the 'Add SSH key' button, input your username and password at the next prompt, and you should be almost set!

You should then be able to see your newly created SSH key. Click the Configure SSO dropdown menu and click Authorize next to illinois-cs-coursework to allow this SSH key to be used with your UIUC repositories.

Changing a remote URL from HTTPS to SSH

Open a terminal and navigate to your ECE220 repository. Execute:

git remote -v

to verify that the remote repository is indeed using HTTPS. You should get an output similar to

origin https://github.com/illinois-cs-coursework/ttYY_ece220_NetID.git (fetch)
origin https://github.com/illinois-cs-coursework/ttYY_ece220_NetID.git (push)

with NetID replaced by your NetID, ttreplaced by the two-letter term abbreviation (sp, su, fa) and YY replaced by the two-digit year (e.g. 19 for 2019).

To change the remote URL, execute the following command with NetID replaced with your own, TT replaced by the two-letter term abbreviation (sp, su, fa) and YY replaced by the two-digit year (e.g. 19 for 2019) :

git remote set-url origin git@github.com:illinois-cs-coursework/ttYY_ece220_NetID.git

Do the same for the release remote URL.

git remote set-url release git@github.com:illinois-cs-coursework/ttYY_ece220_.release.git

Lastly, verify that the remote has been change by running:

git remote -v
  1. https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ 🔗

  2. https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/ 🔗

  3. https://help.github.com/articles/changing-a-remote-s-url/ 🔗

All rights reserved by ECE220@UIUC. Design by Asher Mai & Ivan Abraham.
Last modified: December 28, 2023. Website built with Franklin.jl and the Julia programming language.