Git Repository

We will use the Computer Science Department gitlab site for all lab and project distributions. Access to this site is via https://coursework.cs.duke.edu/ which you may have accessed before if you used it for Compsci 201. You will be added to a group for Compsci 210 specific to this semester and you have to configure your container to use git for this class.

We are using things similar to how you used them in Compsci 201. You will fork labs and projects and submit using gitlab integration with Gradescope. If you are not familiar with git, please let us know so that we can assist in helping you learn.

You should commit and push your code to gitlab frequently since it can serve as a good backup of your work in the event your container fails. Recall, the OIT containers are not backed up and if you are using a local container it will depend on your own backup process. Git is the recommended method in this class for ensuring your efforts are backed up and you are expected to use that.

SSH Keys

You will need to use SSH for gitlab access (clone, add, commit, push, etc.). If you are using the OIT containers follow the steps below. If you are running a local container you have two options: 1) follow the steps below or 2) use git in a terminal on your local machine.

These steps are described here https://coursework.cs.duke.edu/help/ssh/index#generate-an-ssh-key-pair for generating and ed25519 key pair.

Setup git for your container:

  1. ssh into your container, this gives you a terminal on your container

  2. Generate the ssh key: type in ssh-keygen -t ed25519 -C "name_of_your_choice" into your terminal and press enter. (Recommend you use something like cs210containergit for "name_of_your_choice").

  3. Press Enter, DO NOT CHANGE THE FILE PATH

  4. Press Enter, DO NOT ENTER A PASSWORD (note at the bottom of doc about this)**

  5. Press Enter Again

Now you need to add the pubic key to your gitlab (coursework.cs.duke.edu) profile.

  1. One way to do that is the following (according to https://coursework.cs.duke.edu/help/ssh/index#add-an-ssh-key-to-your-gitlab-account)

    1. Type cat ~/.ssh/id_ed25519.pub in a terminal on your container

    2. Select the output of that, it is generally one line that starts with ssh-ed25519. Be careful if there is any line wrap, the key needs to be a single line.

    3. Now add the key to your gitlab profile by following the directions starting at step 2 in https://coursework.cs.duke.edu/help/ssh/index#add-an-ssh-key-to-your-gitlab-account

Once you have completed the above you should be able to clone the first lab to your container.

Setup git for a local container

For those running a container on your local machine, you can use your local host (MacOS or Windows) to run git avoiding the need to generate keys on your containers. This will introduce a bit of complexity in your workflow since you will run git in a local terminal but you need to do all compilation and running of the labs and projects in terminal on your local container. It's easy to forget and try to run git in the container.

Recall that a local container shares a directory with your local machine. So by changing directory (cd) into that shared directory on your local machine you can create files, and run git that are accessible from the container. Likewise, files you edit and create in the container are accessible from the local machine. The model is to do development in the container and use git from your local machine. You may find it easier to just add ssh keys to the container and do all work within the container.

If you have previously setup your local machine with ssh keys to access coursework.cs.duke.edu gitlab instance you are good to go. If you have not previously setup ssh keys for the CS gitlab instance, then you need to following the instructions above but replace step 1 with open a terminal on your local machine.