GitHub Pages: A Beginner's Guide to Publishing Websites 🎯

beginner
9 min

GitHub Pages: A Beginner's Guide to Publishing Websites 🎯

Welcome to our comprehensive guide on GitHub Pages! In this lesson, we'll walk you through creating, customizing, and publishing static websites using GitHub Pages. Let's get started!

What are GitHub Pages? 📝

GitHub Pages is a service that allows you to host static websites directly from a GitHub repository. It's an excellent platform for developers to showcase their projects, share documentation, or even create personal blogs.

Why use GitHub Pages? 💡

  • Collaborative: With GitHub being a version control system, it's easy to collaborate with others on your website.
  • Free: GitHub Pages offers free hosting for personal websites and repositories.
  • Custom Domain Support: You can use a custom domain with GitHub Pages for a professional touch.

Prerequisites ✅

  • A GitHub account
  • Basic understanding of Git and Markdown

Creating a GitHub Pages Website 📝

Step 1: Create a New Repository

  1. Sign in to your GitHub account.
  2. Click on the + icon in the top right corner and select New repository.
  3. Name your repository, e.g., my-personal-website.
  4. Leave the Repository visibility as Public.
  5. Check the Initialize this repository with a README box.
  6. Click on Create repository.

Step 2: Setting up GitHub Pages

  1. Navigate to the newly created repository.
  2. In the right sidebar, find the Settings tab and click on it.
  3. Scroll down to the GitHub Pages section.
  4. From the Source dropdown, select master branch.
  5. Your GitHub Pages URL will be displayed below.

Publishing a Static Website 💡

  1. In the master branch of your repository, create a new file named index.html.
  2. Write your website content in this file using HTML, CSS, and JavaScript (or any static site generator).
  3. Commit and push your changes to the master branch.
  4. Refresh the GitHub Pages URL to see your website live!

Customizing your GitHub Pages Website 💡

  1. Create a new folder named styles in your repository.
  2. Inside this folder, create two files: style.css and script.js.
  3. Write your CSS styles in style.css and JavaScript code in script.js.
  4. Link these files in your index.html file.

Quiz 🎯

Quick Quiz
Question 1 of 1

What is the primary purpose of GitHub Pages?

Happy coding, and we hope this tutorial helps you create and publish your first website on GitHub Pages! 🎉