#2,000 and 10 minutes later

I had a domain name I wanted to hock so I decided to host a static site with purchase instructions for would be buyers and point the domain name to it. It made no sense paying for hosting so I decided to use github pages.

Github pages is a way of hosting static HTML pages on github and there are two types:

(1) User pages
(2) Project pages

Steps to hosting User pages on github.
1. Go to github.com/new and create a new repository i.e. assuming you are already a github user.
2. For the repository name enter “[githubusername].github.io”
3. Make the repository pulic
4. Check “Initialize this repository with a README”
5. Click Create Repository
Now it gets technical. Please note that the following instructions are for UNIX based OSes not Windows.
Open your Terminal and enter the following commands:
$ mkdir /path/to/source-code
$ cd /path/to/source-code
Download your newly created GitHub repository and go inside it.
$ git clone https://github.com/username/username.github.io.git
$ cd username.github.io
6. Now create your static website in html inside the git directory that you are in.
$ git add . (This command would add all the tracked files in your working directory into the staging area awaiting commit)
$ git commit -m “1st static website commit” (All your files are now committed to the HEAD of your git directory)
$ git push origin master (This command pushes your local repository containing your local website to the remote repository on github)
After 10 minutes your should be able to view your static website at http://username.github.io/

P.S: if you want to host your static website with a custom domain, “CD” into your directory and run:
$ touch CNAME
Edit the CNAME file with any text editor of your choice and enter the domain name you might have already registered [1] and save it. Re-run the above commands and if successful, you would be able to also view your static website at http://yourcustomdomain.com. [2]

Notes:
1. Registering a dot com should not cost more than #2,000/year.
2. My static website hosted on github pages can be found at http://hacki.ng. Offers are welcome.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s