How to Create a Website Using GitHub: A Beginner’s Guide

If you’re looking for a simple and cost-effective way to host a personal website, portfolio, blog, or project documentation, GitHub Pages is an excellent solution. It allows you to publish static websites directly from your GitHub repository—for free.

In this post, we’ll walk you through how to create and publish your first website using GitHub Pages, even if you have minimal web development experience.


What is GitHub Pages?

GitHub Pages is a static site hosting service that takes files from a GitHub repository and serves them as a website. It’s perfect for:

  • Personal websites
  • Developer portfolios
  • Project documentation
  • Blogs (especially using Jekyll)

No need for a traditional web host—just your GitHub account and some HTML (or Markdown) files.


Step-by-Step: How to Create a Website with GitHub

Step 1: Create a GitHub Account (if you don’t have one yet)

If you’re new to GitHub, sign up here. You’ll need an account to create and manage repositories.


Step 2: Create a New Repository

  1. Log in to GitHub.
  2. Click the + icon in the top-right and select “New repository”.
  3. Give your repository a name. For a personal site, name it:
    yourusername.github.io
  4. Add a short description (optional).
  5. Select “Public”.
  6. Check “Add a README file” (optional but recommended).
  7. Click “Create repository”.

💡 Naming the repository exactly as yourusername.github.io is key for GitHub Pages to recognize it as a personal site.


Step 3: Add Website Files

You can upload HTML, CSS, JavaScript, or Markdown files in two ways:

Option 1: Direct Upload

  • Click “Add file” → “Upload files”
  • Drag and drop your index.html or other site files.
  • Commit the changes.

Option 2: Use Git Locally

# Clone the repo
git clone https://github.com/yourusername/yourusername.github.io

# Move into the folder
cd yourusername.github.io

# Create an HTML file
echo "<h1>Hello World!</h1>" > index.html

# Push to GitHub
git add .
git commit -m "Initial website"
git push origin main

Step 4: Enable GitHub Pages (if needed)

For personal sites (with the correct repository name), GitHub automatically serves the content. But for project or organization sites:

  1. Go to your repository’s Settings.
  2. Scroll to Pages in the sidebar.
  3. Under Source, choose a branch (usually main) and a folder (/root or /docs).
  4. Click Save.

GitHub will provide a URL like:
https://yourusername.github.io/


Step 5: Visit Your Website

Go to https://yourusername.github.io in your browser. Your website should now be live!

It may take a minute to propagate after the first setup.


Tips for Enhancing Your Site

  • Use Jekyll for templating and blog support (GitHub Pages + Jekyll).
  • Add a custom domain under GitHub Pages settings.
  • Use Markdown (.md) files for simple content creation.
  • Use themes (built-in or custom) to improve design.

Final Thoughts

Creating a website with GitHub Pages is one of the easiest ways to get started with web development and hosting. Whether you’re showcasing your resume, hosting documentation, or building a portfolio, it’s a fast, free, and developer-friendly option.

If you know HTML and CSS, you’re already halfway there. If not, GitHub Pages is still a great way to learn.

Sharing Is Caring:

Leave a Comment