Setting up a domain for free

Prerequisites
Hosting files on Github
You can host as well as deploy your website using Github Pages, but it doesn’t support all the technologies yet, so let’s stick with Netlify. There are various ways you could upload your files to Github, but I’ll use git. You can also use Github Desktop which is user friendly and is a Graphical User Interface.
You can begin uploading files by creating a new repository and following the instructions given there or just go through the docs if you face any issues.
Getting a Domain from freenom
Freenom provides domain names for as long as 12months. You can search for any available domains and see if it’s available for free.
If you have any difficulties in selecting a domain which is free but
you cannot mark it for check out then just search for it with the Domain,
for example if textexample has a free domain textexample.ml, then search for textexample.ml and it’ll automatically be selected and then you can check out for free.
After check-out: Select Services -> My Domains from navigaion bar.
When page loads, Click manage domains and then select Nameservers from Management tools and select Use custom nameservers radio button.
Leave this page as it is and open up Netlify.
Connecting Netflify to Github
Do this only after you’re sure that all the files/dependencies have been uploaded to Github.
Sign in to your Netlify account, you can see an option called New site from git,
click the button and grant Netlify access to all your repositories in Github and setup
the build command if you’re using a library or web-framework like Flask or React.
You’ll see an option called Add a custom domain to your site.
Click it and then paste the domain name you purchased in the textfield.
Now, go to Domain Management section in Domain settings.
Under Custom Domain click the settings or (•••) on the right and select set up Netlify DNS
In the next page: Choose Verify => Yes, Add Domain => Continue and copy all the domain’s nameservers
and paste it in the textfields that were empty in freenom.
Patience
Wait for a while and then you’ll be able to use the domain and visit your website.
Personal blog of Ram Shankar Choudhary. I’m an engineering student working on various projects. I learn in public and write about everything I know.
You may follow me on twitter or join my newsletter for latest updates.