Hosting a Personal Site

Part 1: Remotely
  1. + Menu > New repository > Name: yourusername.github.io (Personal site repo names has to be in this form)
  2. Fill out the Description
  3. Choose Public
  4. Press Create repository button

 

Part 2: Locally
  1. Enter the directory of the project site you want to host.
  2. Initialize repository inside project directory
    git init
    git status
    
  3. Add, Commit and Push files to the master branch of the site repo.
    git add . 
    git commit -m "initial commit"
    git remote add origin <new repo link>
    git push origin master

 


Hosting a Project Site

Project sites are a great way to promote open source projects, as well as host simple front-end projects. Project Pages always use a branch called gh-pages.

Part 1: Locally
  1. Open local project
    Change directory to the local directory of your project.

    git init
    git status
    ----
    On branch master
  2. Create gh-pages branch
    It must be on a branch called gh-pages, so we’ll create it.

    git checkout -b gh-pages
    git status
    ----
    On branch gh-pages
  3. Add an commit files
    git add .
    git commit -m "Initial commit"

 

Part 2: Remotely

Create repository, add remote connection, then push previous commits to gh-pages.

  1. + Menu > New repository > Name: simple to-do
  2. Press Create repository button
  3. Create remote connection
    git remote add origin <repo link>
  4. Push commits into GitHub
    git push origin gh-pages
  5. Refresh GitHub’s project page, and your project site should have been uploaded.
  6. Settings > GitHub Pages > Your site’s URL