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.
12- The name: my-site.
- Public: anyone on the internet can see it.
Step 2: the file index.html
- Click Add file, then Create new file.
- Name the file index.html. That's the name a browser looks for first.
- Write one line in it, say a heading with your name, and commit.
12- Add file
- Create new file
Step 3: switch on Pages
- Open the repo's Settings, and in the menu on the side click Pages.
12- Settings
- Pages, near the bottom of the menu.
- Under Branch, choose main and click Save.
12- Choose main.
- 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.
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.
Read more
- What is GitHub Pages? – GitHub Docs
- Creating a GitHub Pages site – GitHub Docs
- The demo repo my-site – index.html and its history
- The demo site, live – beriki770bot.github.io/my-site