GitHub Pages for Beginners: Your First Static Site in Minutes

Logan Jul 13, 2026

Ready to dive into the world of web development from your own domain? Welcome to the beginner's guide on iyhub.io. Today, we're going to simplify the process of creating your very own website using GitHub Pages. So, let's roll up our sleeves and get started!

GitHub Complete Beginner Guide (2026) | Learn Git & GitHub Step-by-Step
GitHub Complete Beginner Guide (2026) | Learn Git & GitHub Step-by-Step

First things first, what are GitHub Pages? In a nutshell, GitHub Pages is a static site hosting service that takes plain text files and turns them into web pages. It's a perfect platform for beginners, allowing you to create a professional online presence for free. Let's break down the process into manageable steps.

Git & GitHub Roadmap for Beginners
Git & GitHub Roadmap for Beginners

Setting Up Your GitHub Pages Repository

First, you need to create a new repository on GitHub that will host your website. That's right, your website will live in its very own GitHub repository.

Host Websites Free with GitHub Pages πŸš€πŸ’»
Host Websites Free with GitHub Pages πŸš€πŸ’»

To get started, log in to your GitHub account and click on the '+' icon in the top-right corner. Select 'New repository' and name it in the following format: yourusername.github.io. This is a requirement for GitHub Pages to recognize your repository as a website. Click 'Create repository' and you're ready to move on to the next step.

Understanding Your Repository Structure

Git & GitHub Explained for Beginners (2026)
Git & GitHub Explained for Beginners (2026)

Your new repository should now be empty, with a README.md file and nothing else. This is where your website's content will live. The base URL for your website will be http://yourusername.github.io.

Here's a simple structure you can follow for your website: ``` yourusername.github.io β”‚ β”œβ”€ index.html β”œβ”€ about.md └─ ... ``` By default, when you navigate to your domain (http://yourusername.github.io), GitHub Pages will look for an 'index.html' file and display its content.

Initializing Your GitHub Pages

Github Profile
Github Profile

Next, let's initialize Git and GitHub Pages in your repository. In your terminal, navigate to your repository folder and run the following commands:

git init
git remote add origin https://github.com/yourusername/yourusername.github.io.git
git branch -M main
git checkout -b main

Then, create a simple 'index.html' file with the following content and commit your changes:

<!DOCTYPE html>
<html>
<head>
<title>My GitHub Pages</title>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>

Now, push your changes to GitHub using the following command:

Complete Beginner’s Guide to Git and GitHub for 2025
Complete Beginner’s Guide to Git and GitHub for 2025

git push -u origin main

After a few seconds, your website should be live at http://yourusername.github.io. Isn't that exciting?

Adding More Content to Your Website

GitHub for Beginners πŸ§‘β€πŸ’» What You Must Know (2026 Guide)
GitHub for Beginners πŸ§‘β€πŸ’» What You Must Know (2026 Guide)
Top 5 github Projects for beginners
Top 5 github Projects for beginners
How to Host a Website for Free Using GitHub Pages
How to Host a Website for Free Using GitHub Pages
Git & GitHub Cheat Sheet πŸ”₯ | Commands, Workflow, Branching & Version Control (Beginner to Pro)
Git & GitHub Cheat Sheet πŸ”₯ | Commands, Workflow, Branching & Version Control (Beginner to Pro)
Host a website in under 2 minutes (Github Pages)
Host a website in under 2 minutes (Github Pages)
TOP GITHUB PROJECT IDEAS FOR BEGINNERS
TOP GITHUB PROJECT IDEAS FOR BEGINNERS
Git & GitHub Basics Every Engineering Student Should Know πŸ’»πŸš€
Git & GitHub Basics Every Engineering Student Should Know πŸ’»πŸš€
Git & GitHub Cheat Sheet for Beginners
Git & GitHub Cheat Sheet for Beginners
Git Cheat Sheet πŸ”₯ | Essential Git Commands Every Developer Should Know
Git Cheat Sheet πŸ”₯ | Essential Git Commands Every Developer Should Know
GitHub Profile Checklist for Students | Make Your Developer Profile Stand Out in 2026
GitHub Profile Checklist for Students | Make Your Developer Profile Stand Out in 2026
an info sheet with different types of logos and symbols on it, including the words'python project ideas '
an info sheet with different types of logos and symbols on it, including the words'python project ideas '
Git & GitHub Commands Cheat Sheet πŸ’» | Essential Developer Guide
Git & GitHub Commands Cheat Sheet πŸ’» | Essential Developer Guide
Best GitHub Repositories for Students (Free Resources Every Developer Should Bookmark)
Best GitHub Repositories for Students (Free Resources Every Developer Should Bookmark)
GITHUB CHEATSHEET
GITHUB CHEATSHEET
the github chat sheet is displayed in this screenshote screen graber
the github chat sheet is displayed in this screenshote screen graber
Git and GitHub Commands PDF - Complete Guide for Beginners to ProπŸš€πŸ’»  #git #command #code
Git and GitHub Commands PDF - Complete Guide for Beginners to ProπŸš€πŸ’» #git #command #code
πŸ™ GitHub Repositories Every Developer Should Know
πŸ™ GitHub Repositories Every Developer Should Know
Github Cheatsheet
Github Cheatsheet

Now that your 'index.html' file is live, let's learn how to add more content to your website.

Creating New Pages

Let's create an 'about.md' page. Add this file to your repository and commit your changes. To create a link to this new page, update your 'index.html' file to include the following line:

<a href="about.html">About</a>

Notice that we've linked to 'about.html' instead of 'about.md'. This is because GitHub Pages converts '.md' files to '.html' when it generates your website. So, you need to refer to them as '.html' in your links.

Adding Markdown Support

One of the great features of GitHub Pages is its built-in support for Markdown. This means you can write your content in plain text with simple syntax to create headings, lists, and more. Let's update our 'about.md' file with some content:

# About Me
## I'm a web developer
 lΓΆrem **ipsum** dolor **sit** amet.
* coffee
* code
* repeat

When you refresh your website, you'll see that GitHub Pages has converted this Markdown into the corresponding HTML. Isn't that neat?

Customizing Your Website's Looks

Ready to give your website a personal touch? Let's add a custom theme. In your repository, create a new folder named 'stylesheets' and inside it, create a file named 'main.css'. Add the following CSS to give your website a basic layout and style:

body {
  font-family: Arial, sans-serif;
  margin: 2em;
}

h1, h2 {
  color: #333;
}

Then, update your 'index.html' to include this new stylesheet:

<link rel="stylesheet" href="stylesheets/main.css">

Now, push your changes and refresh your website. You should see your new CSS in action!

Building Your Website Further

Now that you have the basics down, the possibilities are endless. You can add JavaScript, use a static site generator like Jekyll, or even host a blog using GitHub Pages.

Adding JavaScript

Let's add a simple JavaScript file to make your website interactive. In your repository, create a new folder named 'js' and inside it, create a file named 'script.js'. Add the following code:

alert('Hello, World!');

Then, update your 'index.html' to include this new JavaScript file:

<script src="js/script.js"></script>

Finally, push your changes and open your website in an incognito or private browsing window. You should see a pop-up alert when the page loads.

Using a Static Site Generator

Static site generators like Jekyll allow you to create dynamic, content-driven websites using markdown files. To use Jekyll with GitHub Pages, you'll need to update your repository's settings and add a few files. For a detailed guide, check out the official Jekyll documentation: https://jekyllrb.com/docs/github-pages/

Hosting a Blog

Another popular use case for GitHub Pages is hosting a blog. To get started, check out this guide on creating a blog using GitHub Pages and Jekyll: https://guides.github.com/features/mastering-jekyll/

And there you have it! You've just created your first website using GitHub Pages. From here, the sky's the limit. Happy coding, and remember, the best way to learn is by doing. Good luck!