Using git on the CS 2040 VM

Steps to set up your VM to access a GitLab repository:

  1. Install Git: sudo apt install git
    If prompted, enter the password for user "student" on the VM.
  2. Set up a key pair to access the repository
    1. Create a key: ssh-keygen
      • Hit return twice, once to put the code in ~/.ssh, the other time for no passcode. You can enter a passcode if you like - it does increase security a bit.
    2. Set up to use the key: eval `ssh-agent`
    3. Add the key to the current keychain: ssh-add
  3. Add the key to GitLab:
    1. Log in to GitLab and Edit profile from the menu by your icon in the upper right corner.
    2. Click on SSH Keys
    3. Display your public key on the console in the VM: cat ~/.ssh/id_rsa.pub
      (cat is short for concatenate and means "concatenate these files to output")
    4. Use the mouse to select/copy/paste the full output of the previous cat command (from ssh-rsa to the account name at the end of the entry) into the Key field in GitLab.
    5. Enter a Title that captures where you generated the key (so you know what to delete later), something like "CS2040 VM Spring 2023".
  4. Create the repository in GitLab. If this is for a class, use the MSOE email address for your instructor and give them Maintainer access.
  5. Use git clone to clone the repository, using the Clone with SSH text.