The web has never been more developer friendly. Deploying a website which used to take days, expert knowledge and immeasurable amounts of patience can now be done by enthusiastic beginners in just a matter of minutes.
If you are new to web development this short guide to launching a website is perfect for you. If you are a seasoned developer you can gain value learning about this super simple method to deploy a website that let's you kick decisions like choosing a framework down the road. It's also great when you just want to get a page up hassle free.
DISCLAIMER: The below technique does not utilize a database, so is recommended for display or informational sites. If you’ll need to store or retrieve internal data, you'll want to go with a more robust service. I strongly recommend checking out Heroku, which also provides free web hosting with just a bit more configuration before launch.
Let's Get Started:
- Log in to GitHub or register an account if you are not a current user. GitHub is a great resource as it utilizes your computer's git VCS (version control system) to track file changes. A deeper understanding of git is helpful, but not necessary for creating a simple site.
- In the top right of GitHub click the Create New Repository button:
Name your new repository using this specific pattern:
My repo is
You don't need to complete any of the other prompts, so select "Create repository" to continue.
- Now that you have your repo set up you'll need to create a directory on your computer to house the files you'll use to create your website. Create a new file directory and navigate inside of it:
mkdir mywebsite cd mywebsite
- Set up git version control in your new directory:
Next set we'll connect our local directory to the remote repo we created earlier:
git remote add origin https://github.com/user/user.github.io
Finally we'll commit these changes and send them to our newly created remote repository:
git add . git commit -m "Initial commit" git push origin master
- The last step is to add a file to render on your site:
echo "Hello World!!!" > index.html
Of course you can add much more to this file, but this is the bare minimum you'll need to get started.
Great! You're ready to launch your website! Fire up your browser and navigate to your site: yourname.github.io.
BONUS: Creating a Custom Domain Name
If you want to take the extra step of acquiring a domain name to use for your website instead of the github generated URL, read on for how to easily set-up a custom domain name.
- Use a domain registrar to purchase a domain name (godaddy.com and namecheap.com are two of the more popular registrars).
- Next you will need to create a CNAME file so github knows you have granted the custom domain access to your site:
echo "www.yourwebsite.com" > CNAME
- Just like before we'll need to commit and push our changes and we're all set on GitHub!
git add . git commit -m "Add custom domain CNAME reference" git push origin master
- Finally navigate to your hosting service and set up a CNAME reference to point your domain name to the page you created on GitHub. Also set the ANAME to point to GitHub's IP Address (126.96.36.199):
It can take 30 minutes or longer for your hosting service to update the whois record. Once the update has been made, your page will be running on your domain name.
You now have a working webpage! Go forth and conquer the world!!!