Start Here: Put a Website Online for Free
If you have been wondering how to publish a website free, GitHub Pages is the tool you have been missing. You can create a free website with GitHub Pages from a web browser, with no credit card, no server, and no monthly bill. This github pages for beginners guide walks you through a live site using a free GitHub account and one small HTML file. In about 20 minutes, you will have a real URL you can send to anyone.
What Is GitHub Pages? A GitHub Pages for Beginners Overview
GitHub Pages is a free static website hosting service built into GitHub. A static website is just a collection of files: HTML for structure, CSS for styling, and JavaScript for extra behavior. There is no server-side program, no database, and no login system running behind the scenes. When someone visits your URL, GitHub sends those files straight to their browser.
Because this runs on a Git workflow, every change you make has a history. If you read our Git for Beginners guide, you already know add, commit, and push. This article is the next step: taking those same commands and using them to publish a website instead of just saving notes or code.
What You Need
You need a free GitHub account. If you do not have one, go to github.com and sign up. You do not need a credit card. You also do not need to know HTML deeply. I will give you a full index.html file to copy.
For the first three steps, you can do everything in your browser. Later, if you want to edit on your own computer, basic git skills help. If you have not used git before, start with our Git for Beginners guide. If you want to feel comfortable typing commands, the Linux terminal basics guide covers 10 commands you will use often.
Step 1: Create Your Repository
Log in to GitHub, click the plus icon in the top right, and choose New repository. The repository name controls your URL.
For a personal site, the name must exactly match your username, followed by .github.io. For example, if your GitHub username is yourusername, name the repository yourusername.github.io. Use lowercase letters, numbers, and hyphens only. Do not use capital letters.
For a project site, you can name the repository anything you want, like my-blog or portfolio. The URL will be https://yourusername.github.io/repo-name.
Set the repository to Public. Free GitHub Pages hosting only works for public repositories. Click Create repository.
| Site type | Repository name | Published URL |
|---|---|---|
| Personal site | yourusername.github.io |
https://yourusername.github.io |
| Project site | any name, like my-blog |
https://yourusername.github.io/my-blog |
Step 2: Add Your First Page
Inside your new repository, click Add file, then Create new file. Name the file index.html. Paste the code below.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First GitHub Pages Site</title>
</head>
<body>
<h1>Hello, I am yourusername</h1>
<p>This is my free website hosted on GitHub Pages.</p>
</body>
</html>
This file tells a browser what to display. The h1 tag makes a large heading, and the p tag makes a paragraph. Change the text inside those tags to anything you like.
After you paste the code, scroll down and click Commit changes. You can keep the default commit message or type something like Add my first homepage. Click Commit changes again.
If you add only a README.md file, GitHub Pages will show a basic page built from that file. For a real homepage, use index.html.
Step 3: Turn On GitHub Pages
In your repository, click Settings. In the left sidebar, click Pages. Under Build and deployment, find Source. Choose Deploy from a branch. Select main as the branch and / (root) as the folder. Click Save.
GitHub Pages will begin building your site. Refresh the Settings → Pages page after 1 to 3 minutes. You should see a green banner with your site URL, such as https://yourusername.github.io. GitHub says it can take up to 10 minutes, but in practice a single HTML page is usually live within a couple of minutes.
That one Save button is all you need to publish a website free. No upload tool, no FTP account, no paid host.
Step 4: Make Changes with Git
Once your site is live, you can edit files directly in GitHub, but real projects are easier to manage on your own computer. This section uses git clone, edit, git add, git commit, and git push.
If you are on Ubuntu, install git first.
# Update your package list
sudo apt update
# Install git
sudo apt install git
Set your name and email once.
# Tell git who you are (first time only)
git config --global user.name "yourusername"
git config --global user.email "yourname@example.com"
Replace yourusername and yourname@example.com with your own values. These are placeholders, not real credentials.
Now copy your repository from GitHub to your computer.
# Download your site repository
git clone https://github.com/yourusername/yourusername.github.io.git
Open index.html in any text editor, make a small change, and save it. Maybe change the paragraph text.
# Move into your site folder
cd yourusername.github.io
# Stage all changed files
git add .
# Save a snapshot with a clear message
git commit -m "Update homepage text"
# Send the snapshot to GitHub
git push
The first time you run git push, GitHub may ask for your username and a password. That password is not your GitHub login password. GitHub now requires a Personal Access Token. To create one, go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic). Generate a new token, choose the repo scope, and paste it when asked for a password. Never put a real token in a public file.
After a push, GitHub Pages rebuilds automatically. Give it 1 to 2 minutes, then refresh your live URL. You do not need to press Save in Settings again.
Step 5: Use a Custom Domain (Optional)
A yourusername.github.io URL works, but you can also connect a custom domain you already own. For example, yourdomain.com looks cleaner on a resume. You need access to your domain registrar's DNS settings. The github pages custom domain setup has two parts: tell your DNS provider where to point, then tell GitHub which domain to expect.
For an apex domain like yourdomain.com, create four A records in your DNS settings.
| Type | Host | Value |
|---|---|---|
| A | @ | 185.199.108.153 |
| A | @ | 185.199.109.153 |
| A | @ | 185.199.110.153 |
| A | @ | 185.199.111.153 |
For a subdomain like www.yourdomain.com, create a CNAME record. Set the host to www and point it to yourusername.github.io.
Back in your repository, go to Settings → Pages. Under Custom domain, type yourdomain.com or www.yourdomain.com and click Save. GitHub will automatically issue a free SSL certificate. Once the DNS changes have spread, check the Enforce HTTPS box. DNS can take 30 minutes to a few hours, so do not panic if it does not work immediately.
Beyond the Basics: Jekyll Themes and .nojekyll
GitHub Pages includes built-in support for Jekyll, a static site generator. Jekyll lets you use themes and write blog posts in Markdown instead of writing every page by hand. You do not need to install Jekyll on your computer. GitHub can process it automatically.
To pick a theme, go to Settings → Pages → Theme Chooser and click Choose a theme. You can also set it in a file named _config.yml.
theme: minimal
Three good starting themes are Minimal for a blog, Cayman for project documentation, and Hacker for technical write-ups. If you edit _config.yml by hand, keep your indentation consistent. Jekyll YAML files generally use two spaces for nested settings. Do not use tabs.
For blog posts, create a _posts folder in your repository. Name each post YYYY-MM-DD-title.md. For example, 2026-08-30-first-post.md. When you push a file with the right name and Markdown content, Jekyll adds it to your blog listing.
If you want a pure HTML site without Jekyll, add a file named .nojekyll to the root of your repository. It can be completely empty. This file tells GitHub Pages to skip Jekyll processing. It is required if your site uses folders that start with an underscore, or if you want GitHub to serve your files exactly as written.
If you want help generating your first HTML or CSS, our write code with AI beginner's guide shows how to use AI tools without needing to memorize every tag.
GitHub Pages Limits and Costs
GitHub Pages is really free for public repositories. There is no monthly hosting fee and no charge for bandwidth. GitHub does have a soft repository size limit of 1 GB, which is huge for HTML, CSS, images, and a normal blog. If your site becomes larger than that, you will likely want a different hosting approach or a paid static host.
The biggest limit is that free Pages hosting only works on public repositories. Any file you push can be seen by anyone who finds the repository. Keep secrets out of your repo. Do not put real API keys, passwords, or tokens in your HTML, JavaScript, or Markdown files.
Every push to the main branch triggers a rebuild. You do not schedule a deploy or click a publish button after the initial setup. If a push contains a broken file, GitHub may fail the build and keep the previous version live until you fix it.
FAQ
Is GitHub Pages really free?
Yes, for public repositories. GitHub does not charge for hosting a static site at yourusername.github.io. You do not need a credit card to start. If you connect a custom domain, you still pay nothing to GitHub, but you do pay your domain registrar for the domain itself. GitHub also provides a free SSL certificate for custom domains.
Do I need to know Git to use GitHub Pages?
You can create and edit a GitHub Pages site entirely in the browser without installing git. The first three steps in this guide use only the GitHub website. To edit on your own computer and push changes, basic git commands help. If you understand git add, git commit, and git push, you have enough. Our Git for Beginners guide covers those commands with plain-English explanations.
Can I use my own domain with GitHub Pages?
Yes. In Settings → Pages, type your custom domain under Custom domain. You then update DNS records at your domain registrar. Apex domains use four A records pointing to GitHub's Pages IPs. Subdomains use a CNAME pointing to yourusername.github.io. DNS propagation usually takes 30 minutes to a few hours. After that, you can check Enforce HTTPS.
Can I make a blog with GitHub Pages?
Yes. GitHub Pages includes Jekyll, which supports blog posts in Markdown. Create a _posts folder and name posts YYYY-MM-DD-title.md. Pick a theme like Minimal, Cayman, or Hacker. You can also use a pure HTML blog if you prefer.
What is a static website?
A static website is made of files that a browser loads directly: HTML for content, CSS for styling, and JavaScript for extra behavior. There is no server-side program, database, or content management system building pages on the fly. GitHub Pages is a static host, which makes it simple, fast, and safe for beginners.
Next Steps
- If you need to learn the commands behind this flow, read the Git for Beginners guide.
- If you want to feel comfortable typing commands, see Linux terminal basics: 10 commands.
- If you are curious about paid setups and domain costs, read build a website under $30.
- If you want AI help writing your next page, try the write code with AI beginner's guide. All code in this article was tested and runs successfully on Ubuntu 20.04 with git 2.25.1 — the index.html markup was validated with an HTML parser, and the git add/commit workflow was executed in a test repository. The git clone and git push steps require a real GitHub account, so they were verified only up to the point where authentication begins — verified August 2026.