Working with GitHub Classroom

The procedures for using Git and GitHub in this class are a bit different from those discussed in the previous lecture. They reason why they are different has to do with the way “organizations” (companies) work.

In any organization, you will have a boss. That boss effectively “owns” all of the work you do for that boss. In our case, you are a student, and I am your “boss”. GitHub lets le create a private “organization” for each class. As the owner of that organization, I own all of the code developed by my “employees”. Well, you are now working for me! (Sorry, no salary is provided for this work!)

Class Repositories

You will not create your own repository for any work you do for this class. Instead, you will get a copy of an empty repository I set up for al students (and for all team projects as well.

How I do that is not very different from what you saw in our last lecture. The big difference is that this repository is private, meaning I control who can access it.

Inviting Collaborators

Once I set up a repository for you to work on, I “invite” you to work on that project. Actually, you will work alone, with me as a co-collaborator on the project.

To do this, all you need to do is click on the correct link below for your class section:

When you click on the right link, GitHub will create a new copy of the empty repo in your account. Technically, it is called a project “fork”.

Sheesh, another strange term.

Basically, a “fork” of a repo is a copy of the repo, placed in your account on GitHub. This one is different, though. It remembers where it came from, and it is actually owned by the original owner (me).

In our class, anything you do in this repository is available to me, and that is how I grade it. I can see it on the web, you can see it on the web, but no one else can (unless I add them, which I will do for a team).

To be able to work on this new repo, you need to “clone” it onto your workstation. Doing this is pretty easy.

A “clone” is a copy of the repository currently on the server, onto your workstation. This copy is already connected to GitHub, so you do not need to do that “remote” add step. Once it is on your workstation, you are ready to add files.

Note

Make sure you use the correct name for this repository in the next step. It is long, but fairly easy to remember.

Creating Your Clone

In the directory where you will keep all classwork (not one under Git control), do this:

Warning

Make sure to use your user name and the correct section number.

git clone https://github.com/ACC-COSC2325-003-SP18/cosc2325-003-projects-rblack42

This will create a new folder named “cosc2325-003-projects-username” in your current directory (where you issued the command). If you cd into that folder, you will see the .git directory and running the remote check will confirn tht it is already connected to GitHub

Working on Assignments

You will create all of your project code and other documents in this directory. Every time you stop working, do the “mantra” to update your GitHub repo.

Note

I will create a clone of your repo on my workstation for grading. If you ever need help with a project, just make sure it is on GitHub and let me know you need help. I will update my copy (are you ready for this new term? I will “pull” your updates to my copy!) I can then run your code myself, and see what is going on. Neat!

Each assignment for this class will be managed in this one repository. Each assignment should live in a separate directory, with the assignment name:

  • hw1
  • hw2
  • lab1
  • etc

Please make the names all lower case. I will be using automated tools to do part of the grading of your work, and those tools look for these names.

At this point, you can submit your homework. For homework one, just record your user name in a text file, and place it in a “hw1” directory.

We will discuss how to set up a lab programming project in a later lecture.

Final Note

Clones are very cool. You can create one any time you like. In fact, if your working copy gets totally messed up, just delete the whole thing, and clone a fresh copy from GitHub. I have had student with laptops that dies during the class. Once they got a new one, the created a clone and pressed on! This is a cool backup system with huge powers we will explore as we work through the course.