Search code examples
githubgithub-pages

How to direct my website to my GitHub Pages Repository?


I am confused completely, because I used GoDaddy's website builder. Unfortunately, I am unable to connect my GitHub Pages Repository to my website, since I pre-built it. Is there any way I can connect my website to my GitHub Repo?

If for some reason at all that this isn't clear, here is what I am trying to say.

How can I take my website, and connect it to my repository, so that when I edit files in the repo that it affects the website also?

Github Pages repo (website in description on top of page): (https://github.com/comet-dev/comet-dev.github.io)


Solution

  • This is the process that worked for me using Google Domains, and should be applicable to GoDaddy as well. Keep in mind this means your site will be entirely reflected in the file structure in your GitHub repo, I do not know how to hook GoDaddy's website builder into this process other than to use it to create files and manually copy them into your repo.

    1. Add a file named CNAME at the root of your public folder. This file should contain the root url of your webpage, e.g., www.example.com

    2. Configure your domain at GoDaddy with the following DNS records. Hopefully this is easy to find under setting / DNS somewhere in GoDaddy. Google Domains and 1&1 both make this very easy.

      • Name: @, Type: A, Data: 192.30.252.153
      • Name: @, Type: A, Data: 192.30.252.154
      • Name: www, Type: CNAME, Data: <username>.github.io

    The two A records contain IP addresses of GitHub's pages server and set you up to be able to respond to example.com rather than www.example.com.

    Hopefully that should be it. It may take some time for the changes to propagate.