1
2
3
4
5
6
7

Step 5 of 7 , Unit 11

Turn On GitHub Pages

Your files are on GitHub. Now you flip the switch. This step takes about two minutes of clicking and a few minutes of waiting. At the end of it, GitHub will give you a live URL.

1

Go to your repository's Settings

From your repository's main page, look for the Settings tab at the top of the page, it is the last tab in the row, usually with a gear icon. Click it.

If you do not see a Settings tab, make sure you are on your own repository page (the URL should show your username). Settings only appears for repositories you own.

github.com/yourusername/yourusername.github.io/settings

Settings opens on a General page with options for your repository name, default branch, and other configuration. You do not need anything on this page, the setting you want is in the left sidebar.

2

Find "Pages" in the left sidebar

On the Settings page, look at the left sidebar. You will see a list of categories. Scroll down until you find "Pages", it is usually under a section called "Code and automation." Click Pages.

  • Settings tab
  • Left sidebar
  • Pages
3

Set the source to "Deploy from a branch"

You will see a section titled "Build and deployment" with a dropdown labeled "Source." Click that dropdown and select "Deploy from a branch."

This tells GitHub Pages to publish your site directly from the files in your repository branch, which is what you want.

4

Choose the branch and folder

After selecting "Deploy from a branch," two more dropdowns will appear: one for the branch and one for the folder.

Set the branch to main (or master, whatever GitHub shows as your default branch). Set the folder to / (root). Then click Save.

github.com/yourusername/yourusername.github.io/settings/pages

After saving, the Pages settings page will refresh. You may see a blue or yellow banner at the top that says something like "GitHub Pages source saved."

After a minute or two, that banner will change to a green banner that says "Your site is live at yourusername.github.io", with a link you can click directly from this page.

It takes a few minutes

After you click Save, GitHub has to build and deploy your site. This usually takes between 2 and 5 minutes. Refresh the Pages settings page every minute or so until you see the green "Your site is live" banner. Do not worry if it takes a little while, this is normal.

5

Watch for the green banner

Refresh the Pages settings page after 2 minutes. When GitHub has finished deploying your site, you will see a green box near the top of the page with your live URL. It looks something like:

Your site is live at https://yourusername.github.io

That URL is your published website. In Step 6 you will visit it and test it.

Still showing a yellow or no banner after 5 minutes?

Try going back to your repository's main page and confirming that you have an index.html file at the root level (not inside any folder). If your index.html is inside a subfolder, GitHub Pages cannot find it and will show an error. Upload a copy of your index.html to the root of the repository and wait another 2 minutes.

GitHub Pages is on

The switch is flipped. GitHub is building your site right now. By the time you finish reading Step 6, it will be ready for you to visit. Your work is about to be on the internet.

← Step 4 Step 6: Your Site is Live →