Free mini-course · Lesson 4 of 4

4 From code to online: publishing on GitHub Pages

Put your app on the internet for free, with a link you can send to anyone.

⏱ 20 min

What you’ll do in this lesson

Put my-first-app online, for free, with a link like your-username.github.io/my-first-app that opens on any phone.

If you built the app from your spec in the last lesson, put it in my-first-app (it can replace the “Hello, world!” page). Then the link you share is your own app, not just the first test.

Three words to know

  • Git keeps the version history of your project, on your computer. Each saved version is called a commit, like a snapshot of the project at that moment.
  • GitHub is a website that keeps a copy of the project in the cloud.
  • GitHub Pages is a free GitHub service that turns that copy into a public website.

Before you start

  • Create a free account at github.com if you don’t have one.
  • Check that Git is installed:
git --version

On a Mac, if it isn’t installed, the system offers to install the developer tools: accept. On Windows, install Git for Windows.

Step 1: Save a version with Git

Open Claude Code in the project folder and ask:

Initialize a Git repository in this folder and make the first commit with all the files. Explain every command you run.

Read the explanations. You don’t need to memorize the commands, but you do need to know what each one does.

Step 2: Send it to GitHub

Pick one of these two paths.

Path A: through the GitHub website

  1. On GitHub, click New repository.
  2. Name: my-first-app. Select Public. Don’t add a README.
  3. Click Create repository and copy the address it shows (it ends in .git).
  4. In Claude Code, ask:
Connect this repository to GitHub at https://github.com/YOUR-USERNAME/my-first-app.git and push the code to the main branch.

Replace YOUR-USERNAME with your GitHub username. If it asks you to log in and your password doesn’t work, that’s normal: GitHub no longer accepts passwords from the terminal. Use Path B, which takes care of logging in.

Path B: with the GitHub CLI (faster)

Install the GitHub CLI, log in once, and create the repository with a single command:

gh auth login
gh repo create my-first-app --public --source=. --push

Step 3: Turn on GitHub Pages

  1. In your repository on GitHub, open Settings.
  2. In the sidebar, click Pages.
  3. Under Build and deployment, choose Source: Deploy from a branch.
  4. Select the main branch and the / (root) folder. Click Save.
  5. Wait a minute or two and reload the page. Your site’s link appears at the top.

The classic first-deploy bug

You tested with a local server and everything looked great. You publish, open the link, and… the site shows up with no styling at all, just black text on a white background. The problem is on one line of this file:

Find the bug

Why did the CSS disappear on GitHub Pages?

Click the line with the problem.

The AI makes this mistake often. If it happens to you, you know what to ask for: “use relative paths for the CSS and JS files”.

Updating the site

Changed something in the project? Ask Claude:

Commit and push the changes with a message that describes what changed.

In a minute or two, the live site updates on its own.

Task

Now on your machine

0 of 6 done

Checkpoint

Check what you learned

  1. What's the difference between Git and GitHub?

  2. Your app uses an API key. Can you put it in the JavaScript on your site?

  3. The site opened with no styling, just black and white text. What is the most likely cause?

Finished the lesson?

Mark it complete to track your progress.

Congratulations, you finished the mini-course!

You picked and installed a coding agent, learned to guide the AI with a spec, and put an app online. That's already more than most people ever do. In the full course, you build a 3D game, a map app, an AI app, and your portfolio.

See the full course