CSE 333 Gitlab Setup

The following instructions are for connecting your CSE Linux environment (attu or VM) to your GitLab repo in preparation for Homeworks 0-4.

Find Your 333 Repository

  1. Navigate to https://gitlab.cs.washington.edu
    • If you have a CSENetID, use the green "CSE NetID" button; otherwise, use the white "UW NetID" button
  2. In your list of Projects, you should see a CSE333 repo (named cse333-20su-students/cse333-20su-<netid>) created for you already.
    • If not, please contact your instructor ASAP to have one created

Add Your SSH Key

This will allow you to access your repo without having to authenticate (i.e., type your password) every time and will greatly improve your workflow.

  1. Check to see if your CSE Linux environment (attu or VM) account already has an SSH key
    • Run
      $ cat ~/.ssh/id_rsa.pub
    • If you see a long string starting with ssh-rsa or ssh-dsa, skip to step 3.
  2. Generate a new SSH key
    • Run
      $ ssh-keygen -t rsa -C "<netid>@cs.washington.edu"
  3. Copy your SSH key
    • Run
      $ cat ~/.ssh/id_rsa.pub
    • Copy the complete key (starting with ssh- and ending with your username and host)
  4. Add your SSH key to GitLab
    • Navigate to your SSH Keys page by clicking on your avatar in the upper-right, then "Settings", then "SSH Keys" in the left-side menu.
    • Paste in the "Key" text box and give a "Title" to idenfity what machine the key is for.
    • Click the green "Add key" button below "Title".

Your First Commit

From your CSE Linux environment (attu or VM), execute the following git commands:

  1. $ git clone <repo url from GitLab project page>
    • Clones your repo -- find the URL by clicking the blue "Clone" button in the upper-right of your project's details page.
  2. $ touch README.md
    • Creates and empty file called README.md.
  3. $ git status
    • Prints out the status of the repo -- you should see 1 new file named README.md.
  4. $ git add README.md
    • Stages a new file/updated file for commit.
    • Should output
      git status: README.md staged for commit
  5. $ git commit -m "First Commit"
    • Commits all staged files with the provided comment/message.
    • Should output
      git status: Your branch is ahead by 1 commit
  6. $ git push
    • Publishes the changes to the central repo, which should now be viewable (may need to refresh) in the web interface.

References