3 minute read Updated

How to make your own website on GitHub Pages

I wrote this guide in 2019 for a course where everyone had to put a personal website online. GitHub Pages hosts it for free, and you only need a browser, Git and a text editor. Every step has a screenshot, so you can check that your screen looks the same before you move on.

GitHub has changed since 2019

The screenshots are from 2019 and some buttons have moved. The Pages settings now live under Settings → Pages, new repositories use a branch called main instead of master, and the green Code button replaced “Clone or download”. The steps are otherwise the same.

1. Create a GitHub account

  1. Go to github.com and click Sign up at the top right. Pick your username carefully: your site will live at yourusername.github.io.

    GitHub home page with the Sign up button marked

  2. Fill in the form.

    The Create your account form

  3. Choose the Free plan.

    Plan selection with the free plan marked

  4. The “customize” page is optional. You can skip it.

    The optional customize page with the skip link marked

  5. GitHub sends you an email. If it isn’t in your inbox, check spam.

    Inbox with the GitHub verification email

  6. Open it and click Verify email address.

    Verification email with the Verify email address button marked

2. Copy the website template

  1. Open the personal website template.

    The personal_website_template repository

  2. Click Fork at the top right. This copies the template into your own account.

    The Fork button marked

  3. If you see a “Forking…” page, wait a few seconds or refresh. If you don’t see it, that’s fine too.

    The Forking page

  4. When it’s done you’re on your own copy, and the Fork button is greyed out.

    Your forked copy with the Fork button greyed out

  5. Open your repositories: https://github.com/yourusername?tab=repositories (use your username).

    The repositories URL in the address bar

    You should see the template in the list.

    Your repository list with personal_website_template

  6. Click personal_website_template, or go straight to https://github.com/yourusername/personal_website_template.

    The repository link marked in the list

    The repository page

  7. Click Settings.

    The Settings tab marked

    The repository settings page

  8. Rename the repository to yourusername.github.io. If your username is ali, the name is ali.github.io.

    Repository name field set to yourusername.github.io

  9. Scroll down to GitHub Pages and set the source to the master branch (on today’s GitHub: Settings → Pages, branch main). If it’s already set, leave it.

    GitHub Pages source set to master branch

  10. Open yourusername.github.io in your browser. You should see the template site. It can take a minute or two the first time.

    The template website live on github.io

3. Install Git and download your site

  1. Go to git-scm.com/downloads.

    The Git downloads page

  2. Click the button for your system. I used 64-bit Windows 10, so I clicked Windows.

    The Windows download button marked

  3. The download should start on its own. If it doesn’t, go to git-scm.com/download/win

    The Downloading Git page

    and pick the installer that matches your Windows (for most people, 64-bit Git for Windows Setup).

    The 64-bit installer link marked

  4. Run the downloaded .exe.

    The downloaded Git installer file

  5. Click Next on every screen. The defaults are fine.

    Show all eight installer screens

    Installer: license Installer: components Installer: default editor Installer: PATH environment Installer: HTTPS backend Installer: line endings Installer: terminal emulator Installer: extra options

  6. On the last screen click Install,

    The Install button marked

    then Finish.

    Completing the Git Setup Wizard

  7. To check that it worked, type cmd in the Windows search box

    Windows search box

    and open Command Prompt.

    Command Prompt in the search results

    Type git and press Enter. If you see a list of Git commands, Git is installed.

    Git's help text in Command Prompt

  8. Back on GitHub, open your yourusername.github.io repository.

    Your repository on GitHub

  9. Click Clone or download (today: the green Code button) and copy the URL.

    Clone or download with the copy button marked

  10. In Command Prompt, make a folder for your projects and clone the site into it:

    cd /d C:\
    md dev
    cd dev
    git clone https://github.com/yourusername/yourusername.github.io.git
    

    Git prints a few lines while it downloads. When it stops, the site is on your computer.

    Git clone output in Command Prompt

4. Open the site in VS Code

  1. Open Visual Studio Code, then File → Open Folder (Ctrl+K Ctrl+O).

    The File menu in VS Code with Open Folder marked

  2. Pick the C:\dev\yourusername.github.io folder and click Select Folder.

    Folder picker with Select Folder marked

  3. You should see the site’s files on the left.

    The site's files in the VS Code explorer

  4. Open _config.yml. Most of the site’s settings are in this one file.

    _config.yml marked in the file list

5. Make it yours

  1. Change the title, your name, the description and the colour skin.

    Site settings in _config.yml

    Further down, fill in your bio, email and social links.

    Author settings in _config.yml

  2. The pages themselves are Markdown files: cv.md, courses.md, blog.md and so on. Edit them like any text file.

    The page files in the file list

  3. To put your changes online, save, then commit and push from the same folder:

    git add .
    git commit -m "My first changes"
    git push
    

    GitHub rebuilds the site after every push. Refresh yourusername.github.io after a minute and you’ll see your changes.