Setting Up git for CS 340

git is the industry standard for collaborative code management. GitHub is the most popular server for attaching git projects to. Among git and GitHub's many collaboration features are a few that will assist us in delivering and grading MPs.

The University of Illinois has an enterprise license to github.com and has enabled some security features which will make connecting to it more secure but also more involved than other GitHub sites.

Creating a GitHub Account

To log into GitHub, you will use your own personal GitHub account (usually not your Illinois NetID, though it is possible you might be able to claim the same ID for github and for the university). You will be privately associating your NetID with your GitHub account to be invited into the course organization for your course (e.g. @cs340-illinois).

If you do not have a GitHub account, you need to create a free GitHub account. Most people use their github.com as part of their professional identity, so choosing a professional username is encouraged (ex: gcevans is Carl Evan's username, not dy$t0pianUnIc0rN).

Creating Your Private Course Repository

In CS 340, all of your work will be submitted in your personal, private repository in @cs340-illinois on GitHub. We have developed a GitHub Repository Creator that will create a private repository for you in @cs340-illinois and set it up with the permissions so that course staff can also access you work.

Creating a Local Clone of Your CS 340 Repository

The git workflow is designed around working on a local clone of your repository that you regularly synchronize with your GitHub repository.

  1. On a terminal, navigate to your CS 340 directory (cs340):

    cd cs340

  2. Clone a local copy of your git repository with the following command (making sure to replace YOUR-GIT-REPO-URL with the URL from the "Course Repository Tool" above):

    git clone <YOUR-GIT-REPO-URL> <NETID>
    # Ex with HTTPS: git clone https://github.com/cs340-illinois/fa23_cs340_gcevans gcevans

    # Ex with SSH: git clone git@github.com:cs340-illinois/fa23_cs340_gcevans.git gcevans

    • ⚠️ You may get errors running this command and will need to set up your access to your GitHub.
    • git error messages are very good! Often the error message will contain a URL where you github provides you the next steps (ex: generating a token, adding OAuth permissions, etc). This command must be successful before you can continue.
    • GitHub is continually changing how parts of their system work; we recommend avoiding anything marked "beta"
  3. Once you have a clone, navigate into your git directory by going into your NetID-named folder:

    cd <NETID>
  4. Connect the release repository, which is where initial code will be provided for you as part of CS 340:

    git remote add release https://github.com/cs340-illinois/fa23_cs340_.release
    • If you get ANY OUTPUT AT ALL, it was NOT successful. (No output means no error! :))
    • git error messages are very good! Carefully and completely read the error message to help you out.
    • If you are not sure, you can run it again and it will say that "the remote already exists".
  5. Finally, let git know your student identity (replacing your name and e-mail):

    git config user.name "Your Name"
    git config user.email "netid@illinois.edu"