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
- Sign in to your GitHub account.
- Click on the
+ icon in the top right corner and select New repository.
- Name your repository, e.g.,
my-personal-website.
- Leave the
Repository visibility as Public.
- Check the
Initialize this repository with a README box.
- Click on
Create repository.
Step 2: Setting up GitHub Pages
- Navigate to the newly created repository.
- In the right sidebar, find the
Settings tab and click on it.
- Scroll down to the
GitHub Pages section.
- From the
Source dropdown, select master branch.
- Your GitHub Pages URL will be displayed below.
Publishing a Static Website 💡
- In the
master branch of your repository, create a new file named index.html.
- Write your website content in this file using HTML, CSS, and JavaScript (or any static site generator).
- Commit and push your changes to the
master branch.
- Refresh the GitHub Pages URL to see your website live!
Customizing your GitHub Pages Website 💡
- Create a new folder named
styles in your repository.
- Inside this folder, create two files:
style.css and script.js.
- Write your CSS styles in
style.css and JavaScript code in script.js.
- Link these files in your
index.html file.
Quiz 🎯
Happy coding, and we hope this tutorial helps you create and publish your first website on GitHub Pages! 🎉