GitHub offers a free way to host websites called GitHub Pages.
- A GitHub account. Sign up here: https://github.com/join
- That's it!
Create a Repository
A GitHub Repository (repo) is where you store your code for a specific project. For instance, the code for my personal website is stored in a repo. Feel free to reference the GitHub Help Create a repo page.
- Click the “+” icon at the top right and select New repository.
- Type in a Repository name.
- Click Create repository.
Build Your Website
You are now on the main page of your new repo. For now, you can ignore everything on this page except where it says “Get started by creating a new file...”
- Click creating a new file.
- Where it says Name your file..., enter
- Populate the page with some HTML. See index.html Example below.
- Click Commit new file at the bottom.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>My New Website</title> </head> <body> <h1>Welcome!</h1> </body> </html>
Deploy Your Website
You should be back on the main page of your repo, and you should see the new
index.html file you created.
- Go to Settings at the top right.
- Scroll all the way down to the GitHub Pages section - it will now display a URL that looks similar to this: https://github.com/username/example-site.
- Click on it to see your website.
Add a Custom Domain
Under the GitHub Pages section, there is a Custom domain section.
- Enter the domain you purchased into that field.
- On the domain provider side of things, GitHub provides some guidance here. It's different for every provider, but it comes down to setting some records.