A common misconception that many (including myself in the past) have is that you need to pay money to host a website with a custom domain. That couldn’t be further from the truth.
Hosting Your Website
So you’re satisfied with how your website looks on localhost. Now what? If you haven’t got a GitHub account, go ahead and make one. Then, create a new repository. You can choose to make it public or private.
If you are familiar with the command line and GitHub, go ahead and push your code. If not, simply click “upload an existing file”
When you upload or push your files, be sure that your index.html is in the root directory. That is, do not have it nested inside any folders. Once you have uploaded your files, go into your “Settings” tab in the repository.
If you scroll down, you’ll see a “GitHub Pages” section. Go ahead and change the source to the master branch.
Once this is done, refresh the page and you’ll see “Your site is ready to be published at *Repository URL*”. If you wait a minute or two and refresh, that message will change to “ Your site is published at *Repository URL*”. Click that link and make sure your page is up.
Getting a Custom Domain
I would suggest getting your domain for 12 months so you don’t have to re-register it for another year. When you’re checking out, it may ask you to sign in again. Do that, and find your way back to the checkout page. It should NOT ask you for any credit card details.
Once that is done, go to services -> My Domains -> Manage Domain -> Manage Freenom DNS. Add “A” records to the following domains:
Once that is done, go to your GitHub pages settings again, and add your custom domain under “Custom domain” and hit save.
If you get this warning, don’t worry. Give it some time and head over to our custom domain. The process can take up to 24 hours (it usually just takes a minute or two) for your domain to link to your Github pages.