GitHub Pages is a free web hosting service provided by GitHub that allows you to host static websites directly from your GitHub repositories. In this tutorial, I will walk you through the steps to create a static site with GitHub Pages.
Here are the steps:
- Create a GitHub account if you haven’t already. Go to https://github.com/ and sign up for a new account.
- Create a new repository. Click on the “New repository” button on your GitHub dashboard. Give your repository a name and a brief description.
- Enable GitHub Pages. Once you have created your repository, go to the “Settings” tab and scroll down to the “GitHub Pages” section. Choose the branch you want to publish your site from (typically the “main” branch), and then click on the “Save” button.
- Choose a Jekyll theme (optional). GitHub Pages supports Jekyll, a static site generator, which allows you to easily add a theme to your site. You can choose a theme by going to the “Settings” tab, scrolling down to the “GitHub Pages” section, and clicking on the “Choose a theme” button. Once you have chosen a theme, GitHub will automatically create a new commit that adds the necessary files to your repository.
- Create your site’s content. Create a new file in your repository with the name “index.md” or “index.html”. This file will be the main page of your site. You can add additional pages by creating new files in your repository.
- Push your changes to GitHub. Once you have created your site’s content, commit and push your changes to GitHub. GitHub Pages will automatically build and publish your site.
- Access your site. Your site will be available at https://your-github-username.github.io/your-repository-name/. It may take a few minutes for your site to be live.
That’s it! You have now created a static site with GitHub Pages. You can continue to add content and make changes to your site by committing and pushing changes to your repository.
Leave a Comment