The instructions below will teach you how to setup your main git repository for the course. Following these instructions early is essential for all future programming assignments.
You should have access to a computer with git. The instructions below assume that you are using a bash shell to do the assignment.
If you do not have much experience working with a Linux shell, please read this
introduction to bash by R. Toal. At the bare minimum, you should be familiar with the commands cd
, ls
, rm
before starting Part I of the assignment.
-
Create a free account in GitHub using your Yale email.
If you already have a GitHub account associated to your Yale email, you can skip this step.
-
Setup SSH keys for your GitHub account so that you can download and commit your code without having to provide your password all the time. Follow these instructions to generate a new SSH key in your machine and upload your public key to GitHub.
If you already setup an SSH key for your GitHub account, you can skip this step.
-
Create an empty,
private repository
in GitHub called cpsc459-assignments or cpsc559-assignments based on whether you are fulfilling the undergrad (CPSC 459) or graduate (CPSC 559) requirements for the course. The GiLab project will be used to store your assignment's code. -
Open the repository page, copy the SSH URL, and paste it in a terminal to
clone your project
into your machine. For example:# Example $ git clone https://github.com/<username>/cpsc459-assignments.git <username>-cpsc459-assignments
where <username> is your GitHub username.
-
Change your directory to your cloned repository.
# Example $ cd <username>-cpsc459-assignments # and check the status of your repository (you should be in the master branch of your repository) $ git status On branch master (...)
-
Create a
new remote called upstream
that points to the assignments repository which contains the set of assignments and starter code.# Example $ git remote add upstream https://github.com/Yale-BIM/f21-assignments.git
NOTE: A Git remote is a pair of alias and URL (link) to another Git repository. By default, your freshly cloned local repository will have a remote named origin that points to your online Git repository in GitHub. The example above tells your local Git repository to track another remote Git repository located at https://github.com/Yale-BIM/f20-assignments.git and name it as upstream.
-
Get the latest
commits from upstream
and merge them into your own local repository.# Example $ git pull upstream master
You should then have separate folders for each of the assignments in your repository.
-
Synchronize commits from your local repository to your remote Git repository in github.com.
# Example $ git push origin master
-
Verify that the commits from upstream are now present in your own GitHub project by checking the project's page in GitHub.
-
Ensure that your repository in GitHub has visibility set to private in Settings -> Manage Access.
-
Add the course instructor and the T.F.(s) as members of your GitHub repository in Settings -> Manage Access. In the Manage access section, choose "Invite a collaborator", and add the Yale usernames for the instructor and teaching fellow(s).
The instructor's email is
marynel.vazquez _at_ yale.edu
, and the teaching fellows' emails arenathan.tsoi _at_ yale.edu
with_at_
meaning@
. -
Once you have finished setting up your repository, fill and submit this Repository Record Form. Your response will be used to check that your repository exists, has been setup properly, and that the instructor and T.F.(s) have access to it.
Once your repository is setup, you will need to follow the steps below when working on a given assignment:
-
Go to the directory containing the assignment, e.g.,
assignment-1
-
Pull updates from upstream:
$ git pull upstream master
If a merge conflict happens, always use latest commit from upstream. Your work is safe as long you commit and push your code to GitHub regularly and only work on the assignments once they are officially "out" per the course schedule.
Once you have resolved any merge conflicts and all commits from upstream are merged successfully to your own master branch, push it back to your own GitHub repository:
$ git push origin master
NOTE: Please consult your T.F.(s) if you have difficulty resolving merge conflict(s).
-
Read the README.md file inside the assignments folder for the instructions on what you have to do.
-
Do the assignment.
-
Whenever you want to save your code, commit your work.
# Example $ git add <list-of-files-to-be-saved> $ git commit -m "<commit-message>"
-
Push your work to GitHub to keep a remote copy.
# Example $ git push
Your final version of the assignment should be pushed to GitHub before the deadline!
-
Write the corresponding assignment report if one needs to be submitted.
-
Repeat steps 3-6 as many times as necessary while you work on the assignment.
-
When you are ready to submit your assignment,
i. Gather the specific
commit hash
(SHA) of the version of the code in GitHub that you would like to be evaluated on and add it to the top of your report if a report is requested for the assignment.To see all of your commits, go to your repository's GitHub page and click where it says "X commits" (right below the download "Code" button in the interface). Copy the commit SHA for the final version of the code and paste it in the report.
ii. Submit the report (with the commit SHA) as a pdf to Gradescope. If the assignment asks for other documents, submit them to Gradescope as well.
Most assignments will appear twice in Gradescope: once for the submission of the report, once for the submission of code. The report and any other extra file that is requested should be submitted to the Report assignment; your code in GitHub should be submitted to the Code assignment.
Note that assignments may have public tests to familiarize you with the process of submitting code through Gradescope. They all have private tests to evaluate your submission. These private tests are tests for which you won't get access to until after the submission date.