Github Setup
Github is going to be our file storage area for all of our code-based assignments. It is a free platform for publicly hosting any files you want. Particularly, it is used for storing plain text files, the kind that are used for writing code and creating software. What’s special about it is that it tracks the changes in files that you store, and allows you to see what has been changed every time a file is saved. Often this is as simple as generally showing you “this line of code has been deleted” (in red) and “this line of code has been added” (in green).
The software that does this is called “Git” and it is known as a “version control system”. It is very common in the software and web development world.
An additional bonus to Github is that it has a feature called Github Pages, which can turn your file structure into an actual website.
So today, what we’re going to do is set up Github for each of you so you will have a home file structure to create and publish your projects.
Step 1: Create account
- If you’ve not already done so, create an account on github.com.
- Once you’ve created your account, check your email and click the blue button to verify your account.
Step 2: Create repository
- Log into github.com and navigate to “Your profile” link in the upper right. Once you’re on “Your profile”, click on the tab that says “Repositories”. Then click the green “New” button. Call it “creativecomputation” and check the box to initiate with a .README file. This repository will be the home for all of your assignments and exercises for this class.
- When you do this, it will take you to the home screen of the repository. Click the green button “Clone or Download” and then “Open in Desktop”.
- Pressing this button should launch the Github application you downloaded before. (If for some reason this doesn’t happen: Open the GitHub Desktop application manually on your computer. Log in using your new GitHub account. Press the “+” button in the upper left hand corner and navigate to the “Clone” tab. As long as you are logged in, your “creativecomputing” repository should show up. Select it and then press the button “Clone creativecomputing”.)
- Select a place on your computer where you want the “local” version of your projects to live. Select the “choose” button, and navigate to the folder where you are keeping your materials for this class and then press the “Open” button. This will create a folder called “creativecomputating” where you chose. Do not move this folder or rename it.
Step 3: Creating your First Webpage
- Download the following webpage template by pressing CMD+S (or File > Save Page As)
- Choose your GitHub repository folder (‘creativecomputing”) as the location for downloading
- Once downloaded, open the file in Sublime Text.
- Add the following line of code between the <body></body> tags: <h1>Hello World</h1>
- Save the file as “index.html”
Step 4: Commit and Push your repository
Key terms to know in Git world: commit: adding changes to the local repository; push: to transfer the last commit(s) to a remote server
- Confirm you see changes made to your file in the “Changes Tab” on the Github app
- Fill in a summary of the change you made (can be anything, for example “Created Index”) and fill out a more detailed description of what change you made: “Created the index.html file for the homepage”.
- Press “Commit” button and then Press “Push Origin” in the top right tab
- Check to make sure your changes were pushed to the master repository Reload your project GitHub home page.
Step 5: Publish your Website
- In your GitHub.com repository page, find the “Settings” tab
- Scroll to Github Pages and press the Select Source and choose the Master Branch from the dropdown. This is the source files for your webpage.
- Slick Save
- Click the link listed in the same section, which should be “https://username.github.io/creativecomputation/“ to view your website that should say “Hello World”. You can now upload any page and publish it to the web.