CSCI-1080 Intro To CS: Web Development

Saint Louis University
Department of Computer Science

Introduction to git

At the end of this section you will learn how to create your own git ‘‘repository", how to turn your repository into a server storing your code (like box or dropbox). We are then going to use this server to host your website for your class project. (if you leave your repository public is free).

To store and publish your files online you could alternatively use your SLU www folder. We will learn how to do so in class. You may even get a domain name of your choice. We will not cover this in class.

In any case, learning how to use git (in depth) is extremely useful, not only if you plan your career on programming. Git is a powerful (opensource) version control system program, used by millions of people to track, coordinate and share computer files, e.g., documents, not just software development products. The name “git” was given by Linus Torvalds (creator and, for a long time, principal developer, of the first Linux operating system) when he wrote the very first version.

You are not going to get tested on your Git knowledge in this class but I encourage you to learn git. You may download this Free “Git Book”. The first three chapters are useful.

Create your own repository

  • Go to, signup using an unlimited public repository for free and verify your email account.

  • On the top right (next to the bell icon), click on your + sign to create a new repository. Give a good name (I encourage you to pick CSCI-1080).

  • Check on “Initialize your repository with a README” (it is always a good idea)

  • You may choose to have this code opensource and pick a GNU General Public License v3.0

  • Click on “Create your repository”

  • You will now have the opportunity to read the github guide (you may ignore it for now) and click on the link of your newly created repository

Your page should look like this:


Prepare your new repository to host your website

  • On GitHub, navigate to your GitHub Pages site's repository.

  • Create a folder in the root of your repository on the master branch called /docs .

  • Under your repository name, click Settings.

  • Use the Select source drop-down menu to select master branch /docs folder as your GitHub Pages publishing source. …

  • Click Save.

  • Your project has been created and you are given a link, for example

  • If you forget your github pages link, go to, click on the Settings tab and scroll down and you will find it under GitHub Pages.

Create your local copy with Git clone

Git is already installed on If you want to use your own computer for your web development and you want github to hsot your domain you first need to install git. Then follow these instructions:

  • make sure you have git installed on your machine typying: git --version

  • Navigate to the local folder where you want to store your files

  • clone your repository (copy the files on github on your computer) using git clone URL, where the URL can be found in your repository page

Upload your files to your remote GitHub repository

  • add a new file or modify an existing file (for example create a new index.html file)

  • type git status to see which files should be uploaded

  • add the files you want to publish with git add, for example, git add index.html

  • confirm that you really want to publish those files with git commit. To do so you must specify a message: git commit -m “changes to index.html”

  • After committing a file you could edit more files and commit again. You have those commits in your local repository, but the (github) server does not have them yet. To really upload them and see your changes online you need to type git push.

  • Refresh your browser at your github URL.

  • If you forget your github pages link, go to, click on the Settings tab and scroll down and you will find it under GitHub Pages.

Delete your repository

It is useful to know how to delete a git repository. From

  • Click to your repository, for example yourUsername/yourRepository for example espositof/CSCI-1080

  • Then in the main toolbar of github click on Settings.

  • Scroll just a little bit down (to the Danger Zone) and you will find Delete this repository button.