Build and Launch a Website with AI
Publish an AI-generated HTML page with GitHub Pages: files, paths and 404s
Publish a personal static site on GitHub Pages, organize HTML and assets, choose the publishing branch, and diagnose missing images, 404s and stale updates.

If an AI tool has already generated an HTML page for you, GitHub Pages can turn it into a link you can share. This works well for personal portfolios, study notes, and simple demos. Get your home page and assets together, upload them to a GitHub repository, and enable Pages.
This guide uses a repository named ai-website and uploads files through the browser. Your finished site will typically be at https://你的用户名.github.io/ai-website/: replace the username placeholder with your GitHub account name. GitHub Free supports Pages for public repositories. A custom domain and any external services may cost extra.
GitHub Pages hosts static files. A site with text, images, links, and interactions that run in the browser can work here. A login box drawn in HTML needs a separate service to handle accounts.
| What you received | Can you follow this guide? | What to check first |
|---|---|---|
An index.html file with inline styles and scripts | Yes | Check external images and links |
| HTML plus CSS, JavaScript, and image folders | Yes | Preserve the paths between the files |
| A screenshot or mockup | Once you have actual web files | Ask the AI tool to generate HTML |
| React or Next.js source that needs dependencies to run | It needs a build and a suitable deployment setup | Find out whether it can produce a static export |
| An app with a database, payments, or server-side jobs | It needs a separate hosting assessment | Identify the backend and data requirements |
Pages does not run server-side languages such as PHP or Python. GitHub also prohibits using it as free hosting to operate an online business, run e-commerce transactions, or provide commercial SaaS. See GitHub Pages limits and the guide to hosting options for AI-built sites if your project needs a backend.
Name the home page index.html in lowercase. Save the images, styles, and scripts it references alongside it.
ai-website/
├── index.html
├── style.css
└── images/
└── cover.png
If the styles are already inside the HTML, you can skip style.css. Extract any ZIP archive before uploading its contents. Check that your editor saved index.html rather than index.html.txt.
You can give your AI tool this prompt.
Prepare this page as static HTML ready to publish. Name the home page index.html and list the CSS, JavaScript, and images I should save with it. The site will live under /ai-website/. Check the relative paths for assets and links, and tell me which features still depend on external services.
Open the home page on your computer and check its text, images, and buttons. References to C:\Users\..., file://..., or localhost will not point to your computer when a visitor opens the site. Keep passwords, API keys, and private files out of the public source.
Sign in to the account you want to use to manage the site. Select New repository, enter ai-website, choose Public, add a README, and create the repository.
A repository is where your project files live. This example is a project site. GitHub uses the special repository name 用户名.github.io for a user site: substitute your actual account name for the username placeholder. A user site has a different URL structure. See GitHub Pages site types.
On GitHub Free, use a public source repository and treat both the source and the website as public. For an invitation-only site, check the available access controls for the published site separately from repository visibility. See the site creation guide.
On the repository’s Code tab, choose Add file → Upload files. Upload index.html and the files it references. Enter a commit message such as “Publish portfolio home page” and commit the upload.
Switch to main and confirm the files are there. If the upload created a branch or pull request, merge the changes into main so the publishing source can pick them up. See how to upload files to a GitHub repository.
You should see index.html at the top level of the repository for this setup. If it is inside an extra ai-website folder, move the site files up one level. Compress oversized images before uploading. The browser uploader accepts files up to 25 MiB each and up to 100 files at a time.
Open Settings → Pages, find Build and deployment, and use these settings.
| Setting | Value in this guide | What it selects |
|---|---|---|
| Source | Deploy from a branch | Publish from an existing branch |
| Branch | main | The branch with your site files |
| Folder | /(root) | The top level of the repository |
Click Save. Select /(root) when index.html is at the repository's top level. If you choose /docs, the home page belongs at the top level of the docs folder on main.

GitHub uses an Actions workflow for branch-based deployments. The workflow runs automatically for this plain HTML example. See GitHub’s publishing source guide.
If your static files include directories whose names start with an underscore, or you have a reason to skip Jekyll, place an empty .nojekyll file at the top of the publishing directory. Build any React project separately and fix asset paths in the files themselves. See GitHub’s notes on static site generators.
Check the Pages deployment on the repository’s Actions tab. After it succeeds, return to Settings → Pages and select Visit site. Share the published address shown there, rather than a repository code view such as github.com/用户名/仓库名.
https://你的用户名.github.io/ai-website/
GitHub says changes can take up to about 10 minutes to publish. If the workflow is still running, follow its progress. If it fails, open that run and look for the specific error. See how to view a published Pages site.
Try the link in a browser signed out of GitHub and on a phone using mobile data. Check that the home page, images, navigation, and main buttons work before adding the address to a résumé or social profile. If your readers are in another region, test access from a network they are likely to use.
| What you see | Where to look | What to do |
|---|---|---|
| Every page returns 404 | Actions, Visit site, and the publishing source | Wait for deployment and verify the branch and folder |
| Only the README appears | Entry file in the publishing folder | Confirm the real home page is uploaded as index.html |
| The home page returns 404 even though the file is in GitHub | Folder depth and filename case | Put lowercase index.html at the top of the publishing source |
| The home page loads but images or styles return 404 | Requested paths and uploaded assets | Check the files and folders, then correct the relative paths |
| An internal page opens through navigation but returns 404 on refresh | Whether a matching static file exists | Use an actual HTML file or a routing setup that fits the project |
GitHub treats Index.html, index.HTML, and index.html as different filenames. Start with spelling, case, and location. See GitHub’s Pages 404 guide.
On a project site, a leading / can drop the repository name from a request. Here is how the browser resolves paths from https://example-user.github.io/ai-website/.
| Path in the page | Path the browser requests |
|---|---|
./images/cover.png | /ai-website/images/cover.png |
/images/cover.png | /images/cover.png |
./about.html | /ai-website/about.html |
For an image stored inside the project’s images folder, use a path like this on the home page.
<img src="./images/cover.png" alt="作品展示图">
The example URL illustrates path resolution; it does not show a deployed example website. Adjust relative paths for pages in subfolders and match actual filenames, including images/cover.png versus images/Cover.png. Replace the image's alternative text with a useful description in your site's language.
Ask the AI tool to edit the local files, then upload the revised files to the same repository. Keep their names and references consistent and commit to the same publishing branch. After deployment, open the same public URL and check a specific line or image you changed.
If you still see the old page, confirm the changes reached main and the new deployment succeeded. Then refresh the page and check for a cached copy. Changes saved locally or committed to another branch still need to reach the configured publishing source. See the guide to troubleshooting an outdated deployment and rolling it back.
For the next step, see the guides to connecting a custom domain, adding forms or logins, and checking Google indexing.