Illustration of a browser window

Create a Simple Website with GitHub Pages

GitHub offers a free way to host websites called GitHub Pages.

Requirements

Octocat's face

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.

  1. Click the "+" icon at the top right and select New repository.
  2. Type in a Repository name.
  3. 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..."

  1. Click creating a new file.
  2. Where it says Name your file..., enter index.html.
  3. Populate the page with some HTML. See index.html Example below.
  4. Click Commit new file at the bottom.

index.html Example


  <!DOCTYPE html>
  <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>My New Website</title>
    </head>

    <body>
      <h1>Welcome!</h1>
    </body>
  </html>
              
Illustration of rocketship

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.