pete > courses > Systems Programming (CSCI 0315), Fall 2026 > git


git for CSCI 0315

For each assignment, you will create a git repository containing your code. If you are working with a partner, your partner will also create a (separate) git repository using the same instructions, and you will link the two as described below.

To keep these relatively confidential, I will be issuing secret strings to each of you via email that you’ll use when creating your repositories on weathertop. You will need to share your secret string with your partner.

This document is not intended to be an in-depth introduction to git, its commands, or its underlying theory. For that, refer to the applicable course lecture notes and the excellent online book.

One-time setup

You’ll need to make your home directory executable so that your partner (and me) can access files within it:

$ cd
$ chmod +x .

Remember that cd with no parameters will take change directory to your home directory, and . is a synonym for the current directory. Default permissions on your home directory are rwx------, so these two commands will change those permissions to rwx--x--x. Because the read permission is not granted for group/other, those collections of users will not be able to list the contents of your home directory, but if they already know the name of the file/subdirectory they want, they will be able to open it (provided the file/subdirectory being accessed has appropriate permissions).

You’ll also need to tell git that it should trust your partner’s repositories, even though the files are not owned by you. This command will do that:

$ git config --global --add safe.directory "*"

Do NOT forget the double-quotes around the asterisks.

If you neglect to run this command, git will complain at you about "dubious ownership" when you attempt to pull from your partner’s repository.

When beginning an assignment…

Create a remote repo on weathertop and then log out:

$ ssh *username*@weathertop.cs.middlebury.edu
username@weathertop$ cd *secret-string*
username@weathertop$ git init --bare assignmentX
username@weathertop$ exit

You must follow this naming mechanism for your repositories on weathertop: create a directory named after the secret string I send you, directly in your home directory; and put your assignments in repositories within that directory named assignmentX, where X is replaced with the number of the assignment. Doing so will enable me to pull your code quickly and reliably.

Clone the repository on weathertop onto your local machine:

$ cd /path/to/your/cs315/workspace
$ git clone ssh://*your-username*@weathertop.cs.middlebury.edu/home/*your-username*/*secret-string*/assignmentX

(This automatically sets up the push remote that we set up manually in class.)

After your partner has performed the preceding steps, link your local repository with their repository on weathertop (select remote-repo-name such that it identifies the remote repository):

$ cd /path/to/your/cs315/workspace/assignmentX
$ git remote add *remote-repo-name* ssh://*your-username*@weathertop.cs.middlebury.edu/home/*your-partner's-username*/*your-partner's-secret-string*/assignmentX

Verify your situation:

$ cd /path/to/your/cs315/workspace/assignmentX
$ git remote -v

You should see four lines: a pair of push/fetch lines, labeled "origin", that correspond to your repo on weathertop; and a pair of push/fetch lines, labeled with the remote-repo-name you specified above, that correspond to your partner’s repo on weathertop.

Assignment workflow

You add and/or modify code and feel you’ve reached a good stopping point (fixed a bug, added a feature, isolated some misbehavior you want to communicate to me or your partner). Now you want to save that stopping point as a new revision in git. Here’s how:

After you’ve pushed, your partner (and your instructor) can then use "git pull remote-repo-name master" to pull the new revision you’ve pushed.

NOTE: be very careful with this for now, as we have not yet discussed how to merge conflicting changes. You should probably still be working side-by-side for assignments 1 and 2 until I introduce that feature (unless you’re comfortable with it already, in which case go nuts).

Last modified: