How to add a custom domain in Github Pages – Tutorial 2
Articles,  Blog

How to add a custom domain in Github Pages – Tutorial 2


Hi Guys, this is sharath again, so in the
last video what we did was we created a web page on Github and hosted using Github Pages.
It generated a URL. The URL was redgadget.github.io/test
and then again a ‘/’. So as I said this, this really looks ugly so let’s say you have a custom URL that
you want to use it on this page. So what do you have to do for that? So that is
simple as well to all you need is a domain name. So i hope you have bought
one from somewhere maybe namescheap or godaddy anywhere. I prefer godaddy
because it’s cheap here. So I buy domains from them and so let’s get started
adding custom URL to our website so let’s go to a repository. So what you
have to do is, you have to add a CNAME file with your URL on it whichever you want your URL to be.
So lets check which URL is free. So in my domain list I don’t have many free, I’m gonna jump
right into truejewels which is…, which is free, “truejewel.in”.
I haven’t configured anything on this, this is really a free one so truejewels.in, let’s see what it redirects to.. hmm.. it’s saying web page is not available so
let’s keep it and we are going to add a CNAME file so this is on the on the master branch
actually so truejewels.in this is all so I CNAME file that
should be a dot so make sure you don’t have any spaces
or you don’t have any spelling mistake here so a CNAME file will not have an
extension. So that you’ve to make sure and let’s commit to the master branch and for some reason i have to do the
same thing on the gh-pages branch as well let’s add a CNAME file again .in true, just double checking. Ok… so
now we are done with the CNAME, let’s see where it redirects to hmm nothing.. Now we have to you know configure the domain so that it will
redirect to our Github Page. So you have to add a “A
record” in your domain registrar. so truejewels.in I’m adding A record so there
has to be an IP which redirects to Github Page. So you can google out Github pages custom domain IP. And click on the first link you get. So these are the 2 IPs provided by Github to add an A record but i don’t think this(IP)
will change if it changes then many, many websites
will go down. So I’m gonna add 600 seconds. So there are two AP so I’m gonna
add another A record err… I think it’s 154 that’s all the
change it has. Yeah let’s finish. Save this Hmm.. That’s good. 154 and we have the CNAME
in GH and master can close this off so ok this might take some time I will come back when it is done. Ok I have
waited for a while now let’s see if this has… It is..!! So as you can see i have
hosted it on trujewels use so it’s working and remember that you know how to add
CNAM file both in master and even the gh-pages branch so that’s all folks. So I
have got the website i wanted to and you can create actually you know very, real good this is a simple upset actually you can
create Blogs which look really good so here if I want
to show this one, this has a URL.. ok this was my long actually this was a
tech blog that I had a long back and i am not not updating it this is a long time ago so this is a
blog and this looks really nice so once you go to the URL and checkout If I want to open this one this is a simple one doesn’t have many
many things in it. You can also create blogs with Github Pages. So i will
teach you how to do that as well. So for now we are happy that you know we have
hosted it(website) with a custom URL so Bye Bye for now so I will see you in the next one.

57 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *