Mini lesson · English

How to publish your website from GitHub

Publish the supplied page from a GitHub practice repository and verify that a later edit reaches the public site.

Start the interactive lessonRead the lesson below

Who is this for?

People who want to put a website online and update it reliably. Ready website files are supplied; you can use GitHub Desktop and a coding assistant without writing Git commands.

Before you start

Your own GitHub and Netlify accounts and GitHub Desktop or equivalent access. Use a separate practice repository and hosting project. The supplied P1 page works even if you have not taken the personal-website lesson. Worked answers are illustrative examples, not completed tests on your account. Replace their sample observations with your own results, or identify the step that is still blocked.

Estimated time: 21–33 min

Estimates for the supplied starter files with prerequisite accounts and tools ready. Setup, deployment queues and delivery/DNS waits take additional time. Estimates exclude installing GitHub Desktop, account access and build queues. Hosting usage depends on your account.

What you will learn

  • Connect a practice repository to hosting.
  • Publish a visible change and verify the public result.
  • Locate the failed stage when the public page is stale.

Workshop files

Step 1

Prepare a page you can recognize

Use the ready P1 website rather than assembling a site first.

Open Workshop files and save index.html, style.css, netlify.toml and .gitignore into one project folder. Open index.html locally to see the P1 homepage, then ask your coding assistant to put those files at the root of a separate practice repository.

The page should visibly say Portfolio version P1. Choose a practice repository and hosting project, checking that neither is an unrelated live site.

A concrete example

Use one workshop folder containing index.html, style.css, netlify.toml and .gitignore. The homepage’s Portfolio version P1 marker makes this exact first version recognizable later.

Use the supplied P1 website and publishing files. Help me put them at the root of a separate practice repository using GitHub Desktop, inspect the changes for private files and connect the repository to my own Netlify practice project. Ask before publishing. Explain how to confirm P1 on the public page, then help me publish a small P2 edit without changing an existing live site.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

How it works (optional)

Put your website online from GitHub

Publishing copies a version of your files to a host so other people can request them.

Your local page, GitHub repository and hosting deployment are three separate places. Saving a file locally does not automatically update the public page. A commit records a version; a connected host can deploy that version.

For this lesson use a new practice project. Make sure the folder contains the actual homepage and stylesheet, not a parent folder with an unrelated collection of files.

For a visible version check, add the paragraph “Portfolio version P1” before the first commit. In the final assignment change it to P2 alongside your meaningful content change. The marker helps you compare a local file, remote commit and deployed page without guessing which copy is open.

Worked example

Alex adds the visible phrase “Portfolio version P1” to a page. That phrase and its commit ID let us distinguish a successful deployment from a browser still displaying an older version.

Extra implementation exercise

You saved P1 locally, but the hosted page still says P0. Which two publication steps might still be missing?

Show a worked solution

Check the repository first, then the host’s deployment record. Refreshing the browser cannot publish a change that never reached the host.

  • Checks whether the change was committed and pushed.
  • Checks whether a successful deployment used that commit.

Step 2

Review and send the change to GitHub

Check the file list before publishing it.

In GitHub Desktop, review the changed files with your assistant. Commit the intended website files and push the practice branch when ready. Keep environment files and account secrets out of the repository.

Open the repository on GitHub and confirm that the intended homepage is at its root. If a private file appears in the changes, remove it before sending anything.

A concrete example

Compare the changed-file list before sending it. index.html and style.css belong in this public page; a private .env file does not. After pushing, inspect the remote file list rather than assuming a local save reached GitHub.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

How it works (optional)

Put the right files in the repository

Commit a small set of public website files, then inspect that set before pushing.

Worked route: create a practice repository on GitHub, then use GitHub Desktop’s File → Clone repository flow to clone it into a new local folder. Add the supplied .gitignore to the cloned folder first. Then copy only your public website files into it, keeping index.html at its root, and inspect the changes before staging/committing.

In GitHub Desktop, inspect the Changes list and diff, write a commit summary, commit to your intended branch, then choose Push origin. If it says Publish branch instead, publish that branch to the remote. The command-line example below is an alternative for an already initialized clone. A Git ignore rule does not remove a secret that was already committed. If you accidentally expose a real key, revoke it and repair the repository; deleting the current file is not enough.

Worked example

The command list stages named site files rather than every file on the computer. It then shows the staged change so you can check what the commit contains.

git add index.html style.css netlify.toml .gitignore
git diff --cached
git commit -m "Add personal website"

Extra implementation exercise

Your staged diff includes .env with a service key. What should you do before pushing?

Show a worked solution

Unstage the file, keep it out of version control and inspect the diff again. If the key reached a remote or other people, revoke it rather than assuming an ignore rule made it private.

Before pushing, inspect the staged diff again. If this repository already had commits, inspect its existing history/remote for the credential without copying the value into a report. Rotate any real exposed key; adding .gitignore cannot erase prior exposure.

  • Removes the secret file from the staged change.
  • Checks whether the credential was already exposed and rotates it if needed.

Step 3

Connect the repository to hosting

Let the host publish the folder that contains the homepage.

Create or choose your separate Netlify practice project and connect the intended repository and branch. For this supplied plain website, use its provided publishing configuration; a framework build is unnecessary.

Wait for the host to report a successful deployment. Open its public URL in a private window and look for P1; a successful dashboard label alone does not confirm the right page.

A concrete example

Local page: P1. GitHub: P1. Host says published, but the public URL shows 404. The next check is whether the host is publishing the folder that actually contains index.html.

Netlify: create deploys

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

How it works (optional)

Connect the host and choose its publish folder

The host needs to know which repository to use and which folder contains the public files.

In your Netlify account create a new project from the practice repository and choose its intended production branch. Authorize only the repository access you need. For plain HTML, leave the build command empty and publish the repository root.

The supplied netlify.toml makes that root explicit. A framework project would instead use its framework’s build output; do not copy this setting into a different project without checking its structure.

Check the folder tree before configuring the host: repository root → index.html and style.css. For this plain-HTML route, publish='.' and no build command go together. A framework's source folder is not automatically its publish output; its own build instructions determine that output.

Worked example

If your root contains index.html, publishing “.” serves that file as the homepage. Publishing a folder that does not contain the built homepage can produce a deployment with a 404 at its root.

[build]
  publish = "."

Netlify: create deploys

Extra implementation exercise

The deploy succeeds, but its homepage is 404. What file and setting should you compare?

Show a worked solution

Confirm that the selected publish directory contains index.html. A successful upload does not prove that the right directory was uploaded.

  • Finds index.html in the repository or actual build output.
  • Compares that location with the publish directory.

Step 4

Trace a stale public page

Compare the repository, hosting record and browser result.

Make a small content edit and mark the page P2 with your assistant. Save, commit and push it, then inspect the matching host deployment. Keep the earlier P1 record for comparison.

Check which version is in GitHub, which version the host deployed and what the requested public URL displays. Browser refresh cannot send an unpushed edit.

A concrete example

GitHub P2 → host P1 → public P1 points to the publishing stage. GitHub P2 → host P2 → public P1 calls for checking the requested URL and delivered response. The same old-looking page can have different causes.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

How it works (optional)

Match the live page to its commit

Check the deployed version and the visitor experience, not just a green deployment badge.

Open the host-provided public URL in a private browser window. Confirm that the homepage and stylesheet load without your owner session. Click the internal links and check the P1 marker.

Compare the host’s recorded commit with the repository’s latest intended commit. A stale page may come from an older deployment, an unexpected branch or caching. Use those observations to choose the next check.

Worked example

A useful record contains the commit, deployment URL and visible marker. If the deployment lists the P1 commit but the page contains P0, inspect the requested URL and response before changing random build settings.

Extra implementation exercise

The repository contains P2, but the deployment record names the P1 commit. Is this mainly a browser-refresh problem?

Show a worked solution

No. Investigate why the host did not deploy the P2 commit. Only diagnose browser caching after confirming the intended version is actually deployed.

  • Identifies that P2 has not been deployed.
  • Checks branch selection and the latest build outcome.

Step 5

Publish and verify P2

Finish with a real public update you can identify.

Publish the P2 change through the same practice route. Open the final address signed out and try the affected link or content. Keep the P1 and P2 change/deployment identifiers from the tools.

Verify the marker and actual changed feature, not only a green deployment icon. State any step you could not finish.

A concrete example

A useful P2 handoff joins three things: the matching repository change, the hosting record and the visible new sentence. A green host icon without the intended public content leaves the last step unchecked.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

How it works (optional)

Your assignment: publish a second version

Show that the publication flow works again after the first successful release.

Make one meaningful visible change, such as adding a project description. Commit and push it through your own repository. Wait for the corresponding deployment, then verify its public page.

Keep both version records. You will use the connection between commits and deployments later when learning previews and rollback.

Worked example

Your before/after record should say what changed and identify both commits. The public URL alone does not identify which version someone saw.

The complete reference walkthrough is available in reference/assignment-walkthrough.txt. Compare its steps with your own result; fill the test record from observations in your own project.

Extra implementation exercise

Publish P2 and provide evidence that the host serves its intended commit.

  1. Change one visible element, update the marker from P1 to P2 and inspect the diff.
  2. Commit and push; find the matching deployment.
  3. Test the public URL and record the new marker.
Show a worked solution

Before the first commit, put 'Portfolio version P1' in a visible paragraph. Save the page, inspect GitHub Desktop's Changes diff, commit only index.html/style.css/netlify.toml/.gitignore and push the intended branch. In GitHub's file view confirm that those four files are at the repository root.

Record the commit ID as P1. In Netlify select the same repository/branch, leave build command empty and use publish='.'. Match the successful deploy's commit to P1, then open its public URL signed out and read the marker. Change the marker to P2, repeat commit/push/deploy, and retain both records.

A useful diagnosis is: repository=P2, deploy=P1, public marker=P1 → investigate branch/build/deploy status. A different case is deploy=P2, public marker=P1 → first inspect the requested hostname/response and cache. Do not publish a secret to test whether Git can hide it; inspect the staged diff and any existing history before pushing.

  • Public content matches the P2 change and recorded commit.
  • Homepage, CSS and navigation work without owner login.

Was this lesson useful?

Leave a like, or share it with someone who could use it.

Continue learning

Explore the other lessons