Computer Science Mojo

~ David's Notes on coding, software and computer science




Post

How to host Project Website on GitHub Pages

Category: Git     Tag: GitHub   Web  
By: David     On: Mon 07 September 2015     

You can host static websites freely on GitHub Pages. They are awesome!

Reading

1. Clone repo

2. Create gh-pages branch

git checkout --orphan gh-pages

3. Remove the previous stuff

might not need to if it's a new repo

git rm -rf .

4. Push

git push --set-upstream origin gh-pages
git push origin gh-pages

5. Custom domain example.com

5.1 CNAME file in repo

in the repo, gh-pages branch, create a file named "CNAME" with a simgle line of your custom domain name "example.com"

5.2 DNS settings at your DNS provider

For apex domain example.com, create A records:

@ 192.30.252.153
@ 192.30.252.154

Or

For subdomain abc.example.com, simply create a cname file pointing to username.github.io