Hosting a Website on GitHub: A Step-by-Step Guide

Berra Sarı
2 min readSep 2, 2023

Hosting a website on GitHub is a great way to quickly and easily share your portfolio, application, project, or blog with the world. It requires minimal setup, and can be done with just a few clicks using GitHub’s built-in tools. In this guide, we’ll walk you through the steps to get your website hosted on GitHub.

Prerequisites

Step 1: Create a GitHub Repository

The first step to hosting your website on GitHub is to create a GitHub repository. This will be the place where you store your website code.

  1. Log in to your GitHub account and click the plus icon in the upper-right corner.
  2. Click New repository.
  3. Give your repository a name. This will be the URL of your website, so choose something that reflects your site.
  4. Click Create repository.

Step 2: Add Your Website Files

Next, you’ll need to add your website files to your repository.

  1. Download and install GitHub Desktop.
  2. Open GitHub Desktop.
  3. Click Clone a repository in the sidebar.
  4. Select your created repository.
  5. Click Clone.
  6. Open the folder and add your website files to it.
  7. Go back to GitHub Desktop, and you’ll see the new files in the Changes tab.
  8. Enter a summary of the changes and click Commit to master.
  9. Finally, click Push in the upper-right corner to upload the changes to your GitHub repository.

Step 3: Enable GitHub Pages

The last step is to enable GitHub Pages, which will make your website live on the web.

  1. Go to your repository’s Settings tab.
  2. Scroll down to the GitHub Pages section.
  3. In the Source drop-down, select master branch
  4. Click Save.

Your website should now be live on the web. You can find the URL in the GitHub Pages section.

FAQ

Q1: How long does it take to host a website on GitHub?

It usually takes less than 10 minutes to get your website hosted on GitHub.

Q2: Does GitHub offer free website hosting?

Yes, GitHub offers free website hosting through their GitHub Pages service.

Q3: Do I need to know HTML and CSS to host a website on GitHub?

Yes, a basic understanding of HTML and CSS is necessary for setting up a website on GitHub Pages.

Q4: What text editor should I use for creating my website?

You can use any text editor you like. Popular options include Atom, Sublime Text, and Visual Studio Code.

Q5: Are there any limitations to hosting on GitHub Pages?

Yes, GitHub Pages is limited to static websites. Dynamic websites such as those powered by JavaScript or PHP are not supported.

--

--

No responses yet