Episode 7 of 7GitHub for Beginners

Your website live with GitHub Pages

The video only loads when you click the picture. Until then your browser does not connect to YouTube.

A repo that is a website

In this episode everything comes together in one thing you can see: a website, live on the internet.

GitHub can turn a repo into a website. The service is called GitHub Pages and it's free. It's made for static sites: a portfolio, a landing page, docs for a project.

Static means that what's in the files is what gets shown. No server running code, no database. For a shop with logins and payments it's the wrong tool. For a page that shows something, it's great.

Everything you learned still works

Every change to the site is a commit, you can go back to any version, and you can try a new design on a branch and bring it in with a pull request.

Step 1: a public repo called my-site

Create a new repo as in episode 1, call it my-site and set it to Public.

The new repository form: name my-site, and the visibility menu open with “Public” selected.12
  1. The name: my-site.
  2. Public: anyone on the internet can see it.

Step 2: the file index.html

  1. Click Add file, then Create new file.
  2. Name the file index.html. That's the name a browser looks for first.
  3. Write one line in it, say a heading with your name, and commit.
The repo page with the Add file menu open and “Create new file” marked.12
  1. Add file
  2. Create new file

Step 3: switch on Pages

  1. Open the repo's Settings, and in the menu on the side click Pages.
The repo settings with the Settings tab and the menu item Pages marked.12
  1. Settings
  2. Pages, near the bottom of the menu.
  1. Under Branch, choose main and click Save.
The GitHub Pages settings: “Deploy from a branch”, the branch menu set to main, and the Save button.12
  1. Choose main.
  2. Click Save.

Step 4: your address

Wait a minute or two and refresh the page. An address appears at the top: your username, .github.io, a slash, and your repo name.

The Pages settings saying “Your site is live at https://beriki770bot.github.io/my-site/”.1
  1. Your address. Click it: that's your website, and anyone in the world can open it.

The demo site from the screenshots is online too: beriki770bot.github.io/my-site.

Changing the site later

Edit index.html, commit, and a minute later it's live. No uploading, no server. The commit is the publish button.

And that's the course: repos, commits, branches, pull requests, issues, forks and clones, and now publishing. That's what most people do on GitHub most of the time. The rest is practice.