Step By Step GitHub DNS Setting

  1. Purchase Domain
  2. Create a Github repository
  3. Add Files in GitHub repository using browser/without GIT installation
  4. Install GIT on Windows
  5. Configure SSH Key in GitHUb
  6. Code Push to The GitHub Repository on Command Prompt Using GIT Commands
  7. Link or DNS setting on Google Domains with GitHub Pages

Step 1 — Purchase Domain

First of all you need to buy a domain from any provider. You can check the listed domains below or you can search on web to find out the best domain provider. You can buy domain from any provider but I suggest you to buy through Google Domains as in this tutorial I have explained and showed example about free website hosting on GitHub with Google domains.

1. Google Domains

2. GoDaddy

3. Bluehost

4. Domain.com

5. Namecheap

6. HostGator More...

Step 2 — Create a Github repository

You need to create an account in GitHub. No need to pay anything to create account in GitHub as GitHub Pages is free.

1. Go to GitHub in a web browser on computer/mobile/tablet any device to join GitHub.

2. You need to enter few details on GitHub to create account such as EmailId, Name, Password etc...

3. By using the same credentials you can login.

4. Create repository. Click on the right side top corner arrow down icon then click on "Your repository" link.


How to create repository in GitHub

5. Click on "New" botton and create your repository.


How to create repository in GitHub

Step 3 — Add Files in GitHub repository using browser/without GIT installation

If you don't want to install GIT on your local machine, you can directly add your files in GitHub repository without having GIT installation. Check the below steps of how to add files without GIT installation. If you want to add your files using GIT commands on command prompt then you can refer the below sections, you may skip this section.

1. Go to the GitHub.com. Click on the right side top corner arrow down icon then click on "Your repository" link.


How to create repository in GitHub

2. Click on your repository name then page will be redirected to another page.

3. Click on "Uploading an exiting file" link.


How to create repository in GitHub

4. You can drag your files in drag section or click on "Chose your files" if you want to select files from directory.

5. Add your commit message in the commit message box.

6. Click on "Commit Changes" botton.


Upload Files in Github in browser without git installation-browse.PNG

Step 4 — Install GIT on Windows

If you want to add/update code using GIT commands, you need to install GIT on your local machine and need to configure.
If you want to add your files directly to GitHub repository using browser then you may skip this section , refere the above section(Step - 3).

1. Go to the GIT Download URL and download.

2. Execute the downloaded .exe file or double click to install.

3. Choose default options and click on next button every time until finish the installation

Step 5 — Configure SSH Key in GitHUb

You need to configure SSH key in GitHub.com from your local machine.
If you want to add your files directly to GitHub repository using browser without GIT installation then you may skip this section, refere the section - 2 only.

1. Go To any folder in your local machine and right click. You will see the two options GIT Gui Here and the second option is Git Bash Here.

2. Click on "Git Gui Here" option.


Git Base

3. Click on "Help" option on the top side of Git Gui.


Help option in Git Gui

4. Click on "Show SSH Key" option under help option.

5. Copy the SSH Key or click on "Copy to Clipboard" option to copy the SSH key.



SSH Key Setup

6. Go to the GitHub.com and click on "Setting" under top right arraw down key.


SSH Key Setup on GitHub

7. Click on "SSH and GPG Keys" link on the left side of page.


SSH Key Setup on GitHub

8. Click on "New SSH Key" botton on the top right side of page.


New SSH Key Botton

9. Write title in the title box. You can give any name.

10. Paste the SSH Key in the Key box. SSH Key you have copied from "Git Gui Here", if not you can copy again from "Git Gui Here"(Refer point 5 in this section).


New SSH Key Botton

11. Click on "Add SSH Key" botton on the down side of the page.

Step 6 — Code Push to The GitHub Repository on Command Prompt Using GIT Commands

If you want to add your files directly to GitHub repository using browser then you may skip this section and refere the above section(Step-3).
First you need pull/fetch the repository in side a folder then need to do the below steps.

1. Go to any folder and right click. You will see the two options here one is Git Gui Here and second one is Git Base Here.

2. Click on "Git Base Here". You will see the GIT command prompt.

3. Go to the GitHub.com and copy the SSH Remote URL.

4. Click on the right side top corner arrow down icon then click on "Your repository" link.

How to create repository in GitHub

5. Click on your repository name that you have created.

6. Click on "Code" botton/link.

7. Click on "SSH" link.

8. Copy the SSH Remote URL from text box.


How to create repository in GitHub

9. Execute git init command on Git Base Here. See the below image for the understanding.

10. Execute git remote add origin {paste the copied remote url} command on Git Base Here. See the below image for the understanding.

11. Execute git fetch command on Git Base Here. See the below image for the understanding.

12. Execute git clone {paste the copied remote url} command on Git Base Here. See the below image for the understanding.


How to create repository in GitHub

Step 7 — Link or DNS setting on Google Domains with GitHub Pages


1. Go to GitHub.com and login.

2. Click on "arrow" icon on the top side right corner.

3. Click on "Your Repository".

4. Click on "Setting" link.

Github pages setting

5. Click on "Pages" link on the left side of the page.



Github pages

6. Change the "Branch" and directory if required then click on "Save" button.



Github pages

7. Write your domain name inside the "Custom Domain Text Box" then click on "Save Button". You can see the message as "DNS Check in Progress" for sometimes.



Github pages

8. Click here to check and copy the IP Addresses from GitHub DNS Details.

9. Scroll down and copy the first four IP Addresses. Those IP Addresses are required to add in Google Domain DNS setting.



Github pages copy IP Addresses

10. Go to Google Domains Site and login.

11. Click on the domain link that you want to configure then click on the "DNS" link. Refer the below image or watch the 10 minutes of video YouTube Video to get more understanding.

12. Google DNS Setting.

- Don't add anything inside the first text box.

- Select the "A" inside the "Type" section.

- Add four text boxex and enter the copied IP addresses seperately.

- Click on "Create new record" link.

- Write www inside the first text box in the 2nd row.

- Select the "CNAME" inside the "Type" section in the 2nd row.

- Write your domain name with .com and without http:// inside the last text box in the 2nd row.

- Click on the"Save" button.



DNS Setting on Google Domains