Sunday, September 16, 2018

Host your domain in Github (A Powerful Source Code Repository)

MeroServer is currently down due to the public IP problem related to ISP. We had setup a raspberry Pi as hosting server which is still up for 24 hours but due to the IP being private, it cannot be browsed from the external networks. We are trying to resolve them as much as we can.

And currently we are trying to migrate some of our static content in Github (A most powerful code repository) from which we can directly host our site.
Currently this site is hosted from this repo and following is the steps for hosting the site in Github.

Steps for hosting website in Github

  1. First of all signin to account in Github and create a new repository.
  2. Now, goto the project folder and initialize a repo.
    $ git init
    
  3. Add the remote url of created new repository
    $ git remote add origin https://github.com/<username>/<repo>
    
  4. Create a file named CNAME and write your custom domain name. For example "beautify.hemshrestha.com.np"
    $ echo git.yourdomain.com >> CNAME
    
  5. Add files to repo
    $ git add .
    
  6. Commit those addition
    $ git commit -m "first commit"
    
  7. Push master branch
    $ git push origin master
    
  8. Create a repo named gh-pages (github-pages)
    $ git checkout -b gh-pages
    
  9. Push gh-pages branch to github
    $ git push origin gh-pages
    
  10. Now the page will be live with the custom domain provided in CNAME file.

Steps for pointing CNAME from your website

  1. Login to your Nameserver Account. For example afraid.org
  2. Click on Subdomain tab.
  3. Click on add subdomain.
  4. Add CNAME record git.yourdomain.com to point github.io. For example beautify.hemshrestha.com.np CNAME github.io
    git.yourdomain.com
    point CNAME record to
    github.io
    
  5. Save the record and wait for 10 minutes.
  6. Browse git.yourdomain.com in the browser and you will see the data pushed in the repo.
See this repo for example
Happy Browsing !!!

No comments:

Post a Comment