Free Website Hosting Setup w/ Github Pages - Day 13

Step 1

Create Github Account

Step 2

Create New Repository in your Github account

Step 3

After the initial setup of your repo and uploading your code create a branch called “gh-pages”. This step is key because the branch name MUST be gh-pages for Github to recognize it as a public facing website.

git init
git add .
git commit -m "first commit"
git branch gh-pages
git checkout gh-pages
git push origin gh-pages

Step 4

Add a CNAME file with your domain name, make sure this is added on your gh-pages branch

git checkout gh-pages
touch CNAME
--- add domain to CNAME file ie. damngoodbrew.co ---
git add .
git commit -m "first commit"
git push origin gh-pages

gh-pages CNAME

Step 5

Go to Namecheap (or whatever domain registrar you use) and click Manage DNS and put the new fields in below:

A Record - @ - 192.30.252.153
A Record - @ - 192.30.252.154
CNAME - wwww - YOURGITHUBUSERNAME.github.io

Namecheap DNS

Step 6

WAIT.. a few hours or a full day, sometimes it takes quite a while for the domain changes to take effect so don’t fret.

Conclusion

Github Pages provides a quick and easy solutions to host static websites for free which I personally leverage all the time for simple landing pages!

Check out the video below for a more in-depth overview for the Zero to Startup in 30 Days Challenge.

Connect Github Pages & Namecheap Domain

Coming Tomorrow -----> Getting Started w/ Google Analytics

Want To Learn How To Turn Your Ideas Into Code?


Written by Tim Moreton who lives and works
in Philadelphia building useful things.