How to host Project Website on GitHub Pages
You can host static websites freely on GitHub Pages. They are awesome!
Reading
- GitHub: create Project Pages manually
- GitHub: Adding a CNAME file to your repository
- GitHub: Tips for configuring an A record with your DNS provider
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