1.) Forking & Syncing a Repo
First thing's first: GitHub Enterprise is weird. At the time of writing, it for some reason doesn't allow access to internal repos until a user has become a member of some organization. If you get a 404 when you go to the assignment repo link, try creating an organization with a random name (perhaps a combination of a childhood home's street name and your favorite snack food... or just a uuid). Then try again. GitHub Enterprise is weird...
Directions for forking an assignment repo and keeping it properly synced.
In the links below, you will want to replace:
YOUR_USERNAME
with your git username.CLASS_ORG
with the current class git orgASSIGNMENT_REPO
with the repo for whatever assignment you are forking
So, for example, for A0 for Fall 2023 Intro to Graphics, we would replace:
https://github.coecis.cornell.edu/CLASS_ORG/ASSIGNMENT_REPO.git
with
https://github.coecis.cornell.edu/Intro-To-Graphics-F2023/A0-Intro-To-Graphics.git
1. Fork the Repo
Click the fork button in the upper right corner of the assignment repo.
2. Create a Local Clone of your Fork
Navigate to your newly forked repo, and clone the fork as you normally would by clicking on the green "Code" button and selecting your preferred method of cloning.
3. Configure Git to Sync your fork
- Navigate to the location of your local clone of the fork
- Type
git remote -v
You should see the current configured remote repository for your fork which will look something like this:
$ git remote -v
> origin https://github.coecis.cornell.edu/YOUR_USERNAME/ASSIGNMENT_REPO_NAME.git (fetch)
> origin https://github.coecis.cornell.edu/YOUR_USERNAME/ASSIGNMENT_REPO_NAME.git (push)
- Type
$ git remote add upstream https://github.coecis.cornell.edu/CLASS_ORG/ASSIGNMENT_REPO_NAME.git
where[assignment#]
is replaced with the number of the specific assignment. Do double check that the URL which followsupstream
is the URL you would copy when cloning the original assignment repo. - To verify the new upstream repository you've specified for your fork, type
git remote -v
again. You should see the URL for your fork asorigin
, and the URL for the original repository asupstream
. It will look something like this:
$ git remote -v
> origin https://github.coecis.cornell.edu/YOUR_USERNAME/ASSIGNMENT_REPO_NAME.git (fetch)
> origin https://github.coecis.cornell.edu/YOUR_USERNAME/ASSIGNMENT_REPO_NAME.git (push)
> upstream https://github.coecis.cornell.edu/CLASS_ORG/ASSIGNMENT_REPO_NAME.git (fetch)
> upstream https://github.coecis.cornell.edu/CLASS_ORG/ASSIGNMENT_REPO_NAME.git (push)
4. Syncing your Fork
We occasionally push out changes to a course repo after the assignment has been released. This has become less common on regular assignments each year, but it is almost certain to happen at some point on creative projects as students often ask us to add some custom functionality to AniGraph, which we make available to the entire class as a rule.
To this end, if there are changes to a repo, we will make an announcement and you can sync your fork by following these steps:
- Navigate to the location of your local clone of the fork
- Type
git fetch upstream
which will fetch the new commits from the upstream repository - Type
git checkout main
to ensure you are on the main branch of your local repo - Type
git merge upstream/main
to merge any changes from the original assignment repo into your local fork
5. Push your Changes (Optional)
Syncing your fork only updates your local copy of the repository. If you want to update your fork on GitHub make sure to push your changes!
Please be careful not to push to the original repo. Github Enterprise is weird and makes this difficult to disallow.