CSC 223 — Authoring for the Web

Github Pages Hello World

Overview

In this assignment you'll set up the web hosting service you'll use for all of the rest of your assignments, GitHub Pages.

Git

Git stores files in a type of database called a repository. Most software teams that work with git keep a central repository on a server somewhere that everyone on the team can access. This repository not only stores the files, but also the history of every change made to each file, including who made the changes and when those changes were made.

Even when working alone, professional developers use version control because it easily allows them to see what's changed in a file over time, as well as to restore a file to any point in its history.

Git works with groups of changes called commits. A single commit might have many changes associated with it. Those changes might include updates to existing files, the addition of new files, or the removal of files.

Imagine a developer named Sally who has started a new job for US Robotics. She's told that her first assignment is to fix a bug in the positronic brain code that is causing all of the robots to randomly attack ice cream shops. She takes the following steps:

Step One: First, Sally will clone the central repository. This creates a copy of the repository on her computer.

git clone https://github.com/us-robotics/brain.git

Step Two: Next, Sally finds the bug in the PositronicBrain.java file that is causing the odd behavior. She quickly fixes the bug and saves her changes.

Step Three: Sally's next step is to add the PositronicBrain.java file to the list of changed files to commit.

git add PositronicBrain.java

Step Four: When Sally is done adding files, she will commit those changes, adding a brief message to describe her changes.

git commit -m "Fixed the bug that made robots attack ice cream shops."

Step Five: Now that her own changes are finished, before she can share them, she must pull any changes her teammates have made from the central repository into her local copy.

git pull

Step Six: After making sure that there isn't a conflict between her teammates' changes and her own, she is ready to push her changes up to the central repository.

Most of your interactions with a git repository will follow the same six steps that Sally followed. Note the sequence of the pull and push commands.

This is critical when working with git: Always pull before you push.

GitHub

One of the reasons that git is so popular is because of GitHub. GitHub is a site that provides repository hosting. You can sign up for a free account and host public repositories that anyone can have access to, or you can sign up for a paid account, which allows you to have private repositories that only you and your team have access to.

By using Github as the central repository, teams can collaborate all over the world, keeping their code in sync easily.

Assignment

  1. Sign up for a GitHub Student Pack.

  2. If you're using a laptop or desktop computer, the steps outlined here to download and configure git on your computer.

  3. Follow steps 1 - 6 of this guide to create your repository.

  4. Configure your site to use GitHub pages.

  5. Publish a page called index.html, which contains the following HTML code:

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
   <p>Hello World!</p>
</body>
</html>

Submit the url to your github pages site. (This should be something like https://USERNAME.github.io/REPOSITORYNAME).