Looking to showcase your HTML skills to the world? GitHub Pages is an excellent, free, and easy-to-use platform to host your HTML website. It's perfect for portfolios, personal projects, or even simple business sites. Let's dive into a step-by-step guide on how to host your HTML website on GitHub Pages.

Before we begin, ensure you have the following: an HTML file (index.html), a GitHub account, and a basic understanding of Git and the command line. If you're not familiar with Git, don't worry; we'll guide you through the essentials.

Setting Up Your GitHub Repository
First, let's create a repository for your HTML website on GitHub.

1. Log in to your GitHub account and click the '+' icon in the top-right corner. Select 'New repository'.
Naming Your Repository

Name your repository in the format 'yourusername.github.io', replacing 'yourusername' with your GitHub username. This is crucial for GitHub Pages to recognize your repository as a website.
For example, if your GitHub username is 'johndoe', your repository name should be 'johndoe.github.io'.
Initializing Your Local Repository

Now, let's initialize a local Git repository for your HTML files.
1. Navigate to your project folder in the command line.
2. Initialize a new Git repository by typing 'git init'.

3. Add your HTML files to the repository using 'git add .'.
4. Commit your changes with a meaningful commit message, e.g., 'Initial commit'.




















Connecting Your Local Repository to GitHub
Next, we'll connect your local repository to the GitHub repository you created earlier.
1. Copy the repository URL from your GitHub repository page. It should look something like this: 'https://github.com/yourusername/yourusername.github.io.git'.
Adding the Remote Repository
2. In your command line, add the remote repository using 'git remote add origin your-repository-url'. Replace 'your-repository-url' with the URL you copied earlier.
3. Push your local changes to the GitHub repository using 'git push -u origin main'. If you're using the 'master' branch instead of 'main', replace 'main' with 'master'.
Enabling GitHub Pages
1. Go to your GitHub repository page. Click on the 'Settings' tab at the top.
2. Scroll down to the 'GitHub Pages' section. Under 'Source', select 'main' (or 'master') branch. Click 'Save'.
3. It may take a few minutes for GitHub to process your website. Once it's live, you'll see a message with your website's URL under the 'Your site is published at' heading.
Customizing Your GitHub Pages Domain
By default, your website's URL will be 'https://yourusername.github.io'. If you'd like a custom domain, follow these steps:
1. Go to your GitHub repository settings and scroll down to the 'Pages' section.
2. Under 'Custom domain', enter your desired domain name. If you have a domain name, you'll need to update your DNS settings with your domain registrar to point to GitHub's servers.
Adding a CNAME File
3. To verify your custom domain, create a file named 'CNAME' (all caps) in your repository's root directory. Add your custom domain name to this file, e.g., 'yourdomain.com'.
4. Commit and push this change to your GitHub repository. It may take a few minutes for the changes to take effect.
Congratulations! You've successfully hosted your HTML website on GitHub Pages. Now, you can share your site with the world and start building your online presence. Happy coding!