GitHub is a great place for hosting your HTML websites. It’s free and you can even use your own domain names.
BTW. Our main website Pinegrow.com is a static HTML website hosted on GitHub Pages.
UPDATE: We now have a new new version of this tutorial.
Sign-up for GitHub
Create a free GitHub account. Skip this step if you already have one.
Download GitHub Desktop app
Download GitHub Desktop application for Mac or Windows. The app will let you work with git through GUI. Skip this step if you already have the app or prefer to use git command line tools.
Create a Git repository
Open GitHub Desktop app and click on Add repository. Select the folder where your website is located and click on “Create & Add Repository” button.
Publish the repository to GitHub
Type a commit message and press Commit & Sync master:
A dialog will popup. Enter the name of the repository (that will be a part of the website’s URL), select if you want to keep the repository private (the website will still be public) and press “Publish Repository”:
Create gh-pages branch
The repository is on GitHub but the website is not yet on GitHub Pages. To do that, create a branch named “gh-pages” (the name tells GitHub to publish this branch as a website) and click “Create Branch”.
Now, make sure that gh-pages branch is selected and publish the branch (send it to GitHub):
The website is online!
The url of your website will be http://<your-github-username>/github.io/<your-repository-name>. You can even use your own domain, so that the url will be http://<your-domain>
Important: the selected branch should always be gh-pages
To publish changes made to the local copy of your website, open GitHub Desktop app, select your repository, type a commit message and click on “Commit and Sync gh-pages“:
Last updated on April 7, 2020 at 3:01 pm