CIS192 Homework Submission

Prerequisites

  • Mac or Linux machine. This is possible on Windows, but some commands will be different.
  • An account on Github. If you have an existing one, feel free to use that. Otherwise, sign up at github.com.
  • Git installed. You can install via binary, or your favored package manager.

Initial Setup

This is a new system. If you encounter errors on our site, please copy and paste the full web page into a private Piazza question. If you have trouble with git/Github, please ask a public Piazza question.

  1. Create an account in our submission system. Your username should be your PennKey.
  2. Now log on to Github. Change your view to the CIS192 class context.

    context.png

    The context menu

  3. Click on the repository we've created with your name. The name will be in the form 'hw_pennkey'. Note this repository is private, and only you and the instructors should have access.

    repolist.png

    Repository list

  4. Copy the repository URL from the repo page.

    repourl.png

    Getting the repository URL

  5. Open your terminal. We are going to clone a copy of the repo so that we can do our work and push it back to Github. First cd to the directory you want your homework folder in (if you don't know what that means, please take a few minutes to read section 3 of this document). Now type
    git clone repo_url_you_copied
    

    put together, that all looks like this:

    bash-3.2$ mkdir penntest
    bash-3.2$ cd penntest
    /Users/zwass/penntest
    bash-3.2$ git clone https://github.com/cis192s13/hw_penntest
    Cloning into 'hw_penntest'...
    Username for 'https://github.com': penntest
    Password for 'https://penntest@github.com': 
    warning: You appear to have cloned an empty repository.
    bash-3.2$ 
    

    We've now copied the (empty) repository onto our computer, so we can cd into that directory:

    bash-3.2$ ls
    hw_penntest
    bash-3.2$ cd hw_penntest/
    /Users/zwass/penntest/hw_penntest
    bash-3.2$ 
    
  6. Now we're going to add the class homework repository as an "upstream" to our personal homework repository. This will allow us to pull required homework files directly from Github. You'll need to execute the following command inside the repository (directory) you just cloned:
    git remote add upstream https://github.com/cis192s13/hw.git
    

    This added the class repository as a git "remote", which means that you can pull changes down from that repository and into your personal repository. Let's do that now. Run the command:

    git pull upstream master
    

    and you should see that files were copied from the server.

  7. Almost done. We need to create a branch that we will make our submissions against. First, create a new branch:
    git branch submit
    

    Now push that branch to Github:

    git push origin submit
    

    Let's also push the master branch to Github:

    git push origin master
    

Whew! We've got the setup out of the way, now you can get to work.

Working on Homework

  1. First get any files/folders that were added to the class repository:
    git pull upstream master
    
  2. Now do your work.
  3. Here's how we get our work onto Github. Pretend we did our homework in the directory hw0 (inside our repository directory), in the files file1 and file2. First we need to git add all the files:
    git add hw0/file1 hw0/file2
    

    Now we make a commit:

    git commit -m "done with hw0"
    

    Now we can push our changes to Github:

    git push origin master
    
  4. Since we've pushed our work to Github, now we just need to let the submission system know that we're done. First we create a Pull Request on Github. Go to your repository on Github and click the Pull Request button.

    pullbutton.png

    Pull request button

  5. Set up the pull request with the base branch as 'submit'

    makepull1.png

    Changing the base branch

    makepull2.png

    Completed pull request

    And send the pull request.

  6. Now go to the 'Submit Homework' tab on the submission website. Select the assignment you'd like to submit, and paste the URL of the pull request you just created. After clicking the 'Submit Assignment' button, verify that the class bot acknowledged your submission. Note: Don't click the 'Merge Pull Request' button on Github.

    ackpull.png

    Acknowledged pull request

Though we only require that you submit your homework with git, it would be wise to use git to keep track of your changes before you submit. To learn more about git, check out Code School's Try Git for a fun 15 minute intro.

Notes

  • If you don't want to type your password every time you try to push or pull from Github, see the documentation on password caching.
  • Feel free to work on a branch other than master (if you know what this means), but please make pull requests against the submit branch.
  • If you're curious about how this system works, check out the Github repo.