DEV Community

Cover image for Hosting a Free Website on GitHub Pages
Scarlet Olexy
Scarlet Olexy

Posted on

Hosting a Free Website on GitHub Pages

Introduction

GitHub Pages provides a simple and free way to host static websites directly from your GitHub repository. This tutorial will guide you through the steps to host your website on GitHub Pages.

Step 1: Create a GitHub Account

If you don't have a GitHub account, sign up for one at GitHub. It's free and provides version control for your project.

Github coding FikFap

Step 2: Create a New Repository

Create a new repository on GitHub for your website. Name it in the format username.github.io, where username is your GitHub username. This special repository name is required for GitHub Pages. Here is an example fikfaps.github.io - feel free to take some inspiration from it.

Step 3: Upload Your Website Files

Upload your website files to the repository. Ensure that your main HTML file is named index.html and that your files are organized appropriately.

Step 4: Enable GitHub Pages

Go to your repository on GitHub, click on the "Settings" tab, and scroll down to the "GitHub Pages" section. Choose the branch you want to use (usually, it's the main branch), and save the changes. GitHub Pages will then build and deploy your site.

Step 5: Verify Your Site

Once GitHub Pages has finished building your site, you can access it at https://username.github.io, where username is your GitHub username. Verify that your website is live and accessible.

Step 6: Custom Domain (Optional)

If you have a custom domain, you can configure it for your GitHub Pages site. In the "GitHub Pages" section of your repository settings, add your custom domain. Follow GitHub's instructions for setting up DNS records with your domain registrar.

Step 7: Updating Your Website

Any changes you make to your repository, including adding or updating files, will be reflected on your GitHub Pages site after a short build time.

Conclusion

GitHub Pages offers a straightforward and free solution for hosting static websites. By following these steps, you can quickly get your website online and share it with others.

Happy hosting!

Top comments (0)