Step 1. Create a Github Pages repository.
Create a new repository with the name mygithubusername.github.io where
mygithubusername is your actual Github username.
Step 2. Create some content for the site.
index.html file in the repository.
Step 3. Go to freenom.com to register a free domain name.
- Sign up an account with freenom.com.
- On the nav. bar, click Services and then Register a new domain.
- In the text bar in the center of the screen, search for you domain name, i.e.
- Choose a domain, by clicking Get it now!, I’m going to pick
- Once Selected, click Checkout, don’t worry, you don’t have to give any bank details!
- Change the Period (how long you want the domain registered to you for) on the right hand side.
- Then click Continue.
- You only need to add your first name only, into the prompted form.
- Check the Terms & Conditions, then click Complete Order.
- Then click Go to your client area button.
Step 4. Setting up the DNS to your website.
- Using the nav bar, click Services then click, My Domains.
- Click the Manage Domain button, it will have a little gear sign next to it.
- Using the tabs, click the Manage Freenom DNS button.
- Add a record with a blank name section, Type as A, TTL as 300 and the Target as 126.96.36.199.
- Add another record, this time with a name section with the contents of WWW, Type as A, TTL as 300 and the Target as 188.8.131.52.
You should have something that looks like this:
Step 4. Make Github use that domain.
- Go back to github.com.
- Go to the
- Scroll down to GitHub Pages, if your repo is on the
gh-pagesbranch then set the source as gh-pages, if your repo is called
mygitubusername.github.iothen your branch will be master. This is because the gh-pages branch is for individual projects pages, whereas the
mygithubusername.github.iorepo is for your personal website, and therefore is on the master branch, since it is automatically a Github Pages site. Read more on difference between User/Organization & Project sites.
- Set the Custom domain to the domain you registered on freenom.com, in my case, I would set it to
- Go back into the repo, create a new file called
CNAME, no file extension.
- Add to the first line in
CNAMEthe name of your website, I would add
Check this repo for an example: https://github.com/twentytwoo/startpages.cf
- Save and commit the new file.
And you’re done!
Hopefully that should work :)