# Github is social coding website where we can host, collaborate with others on our code.
# Near month ago, I've made a repository to host
CDN of
SeeBeeTee in
Github. But in first try I can't get working. So I've written an email to Github Support. And they've answered quickly and it just solved my problem.
Why you should host cdn or website in Github?
- Github is totally free if you would like to host your website/sub-domain publicly. Yeah It costs if you want to make private repositories.
- Github Support is awesome.
- It supports Jekyll. Which is static site generator. (Many of bloggers host their blogs on Github.)
- We can also host One Page Website by just adding
index.html and some stylesheets, images etc.
- It works on
git which is version control system so we can also see our previous version of website, make new branches, people can submit pull request etc.
# There is no support for php right now.
How to?
- First of all make a new repository in Github of your choice like if you want to host cdn of example.com then you should name repository cdn.example.com.
- Clone it in your desktop via Github app... or what you used to clone repositories from github.
- Then delete the branch master if it's there (It's there if you checked Initialize this repository with a README and/or added .gitignore and/or added license file), and then just make a new branch called gh-pages.
- Then add your content there like index.html, style.css, images etc.
- Then add CNAME which is used to set-up sub-domain with Github, in CNAME write your sub-domain name like cdn.example.com.
- Commit and Push it to Github.
- Go to your Domain Control Panel(where you've bought your domain) and go to domain's CNAME Records.
- Add a CNAME record with host name like here cdn.example.com and in the value field type username.github.io. (username will be your username of Github/organization username of Github.)
- Then click Submit/Add Record.
# Now wait for some minutes (near 10 minutes) and your
sub-domain will be hosted in
Github.
Enjoy.
# If you face any problem(s) while doing this you can email to Github Support or just fill
this form.
# Thank you very much for reading. Have a Nice Day :).