1. Create a Repository
- Log in to GitHub.
- Click the + icon in the top-right corner and select New repository.
- Under Repository name, type
username.github.io(replaceusernamewith your exact GitHub username in lowercase). - Set the visibility to Public (required for free accounts).
- Check the box to Add a README file.
- Click Create repository.
2. Add Website Files
- Inside your new repository, click Add file and select Create new file (or Upload files if you already have files ready on your computer).
- Name your primary file
index.html. “IMPORTANT: Your homepage HTML file must be called "index.html", and it must exist in the top-level directory.” -- [Tyler Fisher / GitHub Gist]. - Add basic HTML content to the file, such as:html
<!DOCTYPE html> <html> <head> <title>My GitHub Website</title> </head> <body> <h1>Hello, world!</h1> </body> </html>Use code with caution. - Scroll down and click Commit changes to save the file.
3. Activate GitHub Pages
- Navigate to the Settings tab under your repository name.
- In the left sidebar under the "Code and automation" section, click Pages.
- Under Build and deployment, locate the "Source" dropdown and ensure Deploy from a branch is selected.
- Under Branch, change the dropdown from "None" to
main(ormaster). - Leave the folder as
/ (root)and click Save.
4. Visit Your Live Site
- Wait 1 to 2 minutes for GitHub to process the deployment.
- Open a web browser and type
https://username.github.io(swapping in your actual username). Your site is now live to the public!