Home首頁  /  Lessons課程  /  Lesson 1第一課

Publish Your First Website on GitHub把你的第一個網站發佈到 GitHub

By the end of this lesson you'll take an HTML file made by an AI tool and turn it into a real website — with a link you can share with your students, your school, or your family. Everything happens in your browser. No coding, nothing to install.

上完這一課,你會把一個由 AI 工具做出來的 HTML 檔案,變成一個真正的網站,並得到一個可以分享的連結——傳給學生、學校或家人都能打開。全程在瀏覽器裡完成,不用寫程式、不用安裝任何東西。

What you'll be able to do你將學會

  • a Create your own GitHub accounta 註冊一個屬於自己的 GitHub 帳號
  • b Make your first repository (a folder for your website)b 建立你的第一個 repository(放網站的資料夾)
  • c Upload an HTML file made by an AI toolc 上傳 AI 工具生成的 HTML 檔案
  • d Publish a live website link and share itd 發佈一個可分享的網站連結
Before we start.開始之前。 Have ready: a computer with a web browser, an email you can open during class, and one HTML file (for example, a page you made with an AI tool). No file yet? That's fine — your teacher will give you a sample. 請準備好:一台有瀏覽器的電腦、一個上課時能收信的 email、以及一個 HTML 檔案(例如你用 AI 工具做的頁面)。還沒有檔案也沒關係——老師會給你一個範例。
Part A

Create your GitHub account建立你的 GitHub 帳號

GitHub is a free service that stores websites and shares them online. First, let's make your account.GitHub 是一個免費的服務,可以存放網站並分享到網路上。我們先建立你的帳號。

  1. Open github.com打開 github.com In your browser, go to github.com and click Sign up in the top-right corner.在瀏覽器前往 github.com,點右上角的 Sign up(註冊)。
  2. Enter your email, password, and username輸入 email、密碼和使用者名稱 Your username will appear in your website link, so pick something simple — like teacher-anna. Lowercase letters and numbers work best.你的使用者名稱會出現在網址裡,選一個簡單的——例如 teacher-anna。建議用小寫字母和數字。
  3. Verify your email驗證你的 email GitHub sends a code to your inbox. Copy it and paste it back to confirm. No payment is ever needed — this is free.GitHub 會寄一組驗證碼到你的信箱。複製後貼回去確認即可。完全不需付費——這是免費的。
  4. You're in.完成了。 You now have a GitHub account. Keep this browser tab open.你現在有 GitHub 帳號了。先讓這個分頁開著。
Screenshot — GitHub sign-up page截圖位置 — GitHub 註冊畫面
Part B

Create your first repository建立你的第一個 repository

A repository (or "repo") is simply a folder that holds your website's files. Let's make one.一個 repository(簡稱 repo)就是放網站檔案的資料夾。我們來建立一個。

  1. Click +New repository+New repository Find the + in the top-right corner and choose New repository.在右上角找到 +,選 New repository(新增儲存庫)。
  2. Name your repository為 repository 命名 Type a simple name like my-first-website. Use lowercase letters and hyphens, no spaces.輸入一個簡單的名字,例如 my-first-website。用小寫字母和連字號,不要空格。
  3. Choose Public選擇 Public(公開) Public means people can open your website with the link. That's what we want.Public 代表別人能用連結打開你的網站——這正是我們要的。
  4. Tick Add a README file勾選 Add a README file This adds a short description page so your repo isn't empty.這會加一個簡短的說明頁,讓 repo 不是空的。
  5. Click Create repositoryCreate repository Done — you now have your own repository.完成——你現在有了自己的 repository。
Screenshot — "Create a new repository" form截圖位置 — 建立新 repository 的表單
Part C

Upload your HTML file上傳你的 HTML 檔案

Now we add the website file an AI tool made for you.現在把 AI 工具幫你做的網站檔案加進去。

Most important rule:最重要的一條規則: your main file must be named exactly index.html. That's the name GitHub looks for when opening your site. If your file has another name, rename it to index.html first. 你的主檔案名稱必須剛好是 index.html。這是 GitHub 打開網站時會找的名字。如果叫別的名字,請先改名為 index.html
  1. Click Add fileUpload filesAdd fileUpload files Inside your repository, find Add file and choose Upload files.在 repository 裡找到 Add file,選 Upload files(上傳檔案)。
  2. Drag your index.html into the boxindex.html 拖進上傳框 Drag the file from your computer into the upload area — or click choose your files. If your page has images too, drag them in as well.把檔案從電腦拖進上傳區——或點 choose your files。如果頁面還有圖片,也一起拖進去。
  3. Click Commit changesCommit changes Scroll down and click the green Commit changes button. "Commit" just means "save". Your file is now on GitHub.往下捲,點綠色的 Commit changes。「Commit」的意思就是「儲存」。你的檔案現在在 GitHub 上了。
Screenshot — drag-and-drop upload area截圖位置 — 拖放上傳區域
Part D

Publish your website link發佈你的網站連結

Last step — turn on GitHub Pages, the free feature that puts your site online.最後一步——開啟 GitHub Pages,這個免費功能會把網站放上網路。

  1. Open Settings打開 Settings At the top of your repository, click the Settings tab.在 repository 上方,點 Settings(設定)分頁。
  2. Click Pages in the left menu在左側選單點 Pages Scroll the left sidebar until you see Pages, then click it.捲動左側選單,找到 Pages 點進去。
  3. Set the source to main把來源設為 main Under "Build and deployment", set Source to Deploy from a branch, choose branch main and folder / (root), then click Save.在「Build and deployment」下,把 Source 設為 Deploy from a branch,分支選 main、資料夾選 / (root),再點 Save
  4. Wait about a minute, then refresh等大約一分鐘,然後重新整理 A link appears at the top of the Pages screen. It looks like this:Pages 畫面上方會出現一個連結,長得像這樣:
    https://your-username.github.io/my-first-website/
  5. Share it.分享出去。 Open the link to see your website live, then send it to your students, school, or family. It works on any phone or computer.打開連結就能看到網站上線,把它傳給學生、學校或家人。任何手機或電腦都能打開。
Screenshot — the live GitHub Pages link截圖位置 — 發佈後的 GitHub Pages 連結
FAQ

If something doesn't work如果遇到問題

The link shows "404"連結出現「404」

Wait 1–2 more minutes and refresh. The first publish takes a moment.

再等 1–2 分鐘後重新整理。第一次發佈需要一點時間。

A blank or wrong page空白或顯示錯誤

Check the file is named exactly index.html, all lowercase.

確認檔案名稱剛好是 index.html,全部小寫。

Want to change the page?想修改頁面?

Upload a new index.html the same way. The site updates in about a minute.

用同樣方式再上傳一個新的 index.html,約一分鐘後就會更新。

You did it — quick recap你做到了——快速回顧

  • Created a free GitHub account建立了免費的 GitHub 帳號
  • Made a public repository建立了一個公開的 repository
  • Uploaded an index.html file上傳了 index.html 檔案
  • Turned on GitHub Pages and got a live link開啟了 GitHub Pages,拿到上線連結
  • Shared your website with the world把你的網站分享給了全世界