How to Make a GitHub Website from Scratch

Author

Reads 525

Computer Coding
Credit: pexels.com, Computer Coding

Creating a GitHub website from scratch can seem daunting, but it's actually quite straightforward. You can start by creating a new repository on GitHub.

To do this, you'll need to sign up for a GitHub account if you haven't already. GitHub is free to use, even for large projects.

Once you have a GitHub account, you can create a new repository by clicking the "New" button in the top right corner of the GitHub dashboard.

Getting Started

To make a GitHub website, you'll first need to create a free account on GitHub. This can be done by going to github.com and following the sign-up process.

Having a GitHub account will give you access to a repository, or special folder, where you can store your website's code. You can think of it as a digital folder that lives online and is accessible from anywhere in the world.

To get started, you'll need to create a repository and add a file to it. The file should be named index.html, and you can customize the text to say your name and a welcome message.

Expand your knowledge: Watch Royal Pains

Create a Account

Credit: youtube.com, How to Create an Account and Get Started on SilverStripe (2024)

To get started, create a Github account by going to github.com in your browser. This will be your hub for uploading and sharing versioned code with others.

Github is a website that allows you to do just that - upload and share code. It also supports simple website hosting.

Go to github.com and click on the "Sign up" button to create a free account. This will only take a minute or two.

Your free account will give you access to all the features you need to get started with versioned code and simple website hosting.

Explore further: Website Code Audit

Create Index.html File

GitHub Pages is a great option for hosting static websites for free. You can get started with it in just a few minutes.

To create your first web page, you should be redirected to the repository page, which shows an empty repository. It's time to add a file!

Click the "creating a new file" link on that page to start. Name your file index.html. Now, you're ready to copy and paste the code into the file.

Commit and Push

Credit: youtube.com, Using Git & GitHub in VSCode: Stage, Commit, and Push

As you work on your website, you'll need to save your changes and make them available online. To do this, you'll need to commit and push your changes to the remote host.

Git is a version control system that tracks changes to your project over time, allowing you to manage different versions of your files.

To commit your changes, scroll down and click Commit changes, which will save and push the changes you made to the gh-pages branch.

Make commits with descriptive messages summarizing the updates, so you can easily keep track of what's changed.

Setting Up Your Website

To set up your website, start by creating a GitHub repository. Log into GitHub and click the "+" icon in the top-right corner to create a new repository. Give it a clear name like yourusername.github.io, replacing "yourusername" with your actual GitHub username.

Make sure it's public, add a README file, and click "Create repository". Your website files will live in this new repo. The initialize with README option creates a starter file explaining the project - good practice when starting a new repository!

To customize the deployment of your site, click on the repository settings tab, then from the left-hand side menu, click Pages under the Code and Automation section. Choose the branch (and optionally sub-directory) from which you would like GitHub Pages to deploy your website.

Create Your Repository

Credit: youtube.com, Host website on github for free in just 2 mins

To create your repository, log into GitHub and click the "+" icon in the top-right corner. This is where you'll start building your website's home on the internet.

You'll want to choose "New repository" and give it a clear name like yourusername.github.io, replacing "yourusername" with your actual GitHub username. This will be the address of your website.

Make sure to select the public option, so your website is accessible to the world. You can also add a README file, which is a great way to explain your project to others.

Your website files will live in this new repo, and it's a good idea to initialize with README to create a starter file explaining the project. This is a good practice when starting a new repository!

Host A Website

Open your preferred browser and type your website's URL (your GitHub username followed by .github.io) into the address bar. Your page should now be hosted through GitHub Pages and publicly accessible.

Credit: youtube.com, How to Put a Website Online: Template, Coding, Domain, Hosting, and DNS

Note that if you attempt to access the page immediately, you may get a 404 error, but just wait for a minute or so and you'll be able to access your page.

In GitHub, code is stored in a repository, or repo, which is like a special folder that lives online and can be accessed from anywhere in the world.

To view and share your website with others, you'll need to update the website URL to match your GitHub username by clicking the Edit button next to "Website URL".

If you try to navigate to your URL right now, you'll get a 404 Error: Not Found, so you'll need to push some changes first to the gh-pages branch before GitHub will build your website.

By default, GitHub Pages will deploy the content of your repository from the main branch, but you can alter this behavior by clicking on the repository settings tab and choosing the branch from which you'd like GitHub Pages to deploy your website.

GitHub Pages supports the use of custom domains as well as the change of the root URL to any sub-domain you own, including www subdomains, custom subdomains, and apex domains.

Credit: youtube.com, Understanding Web Hosting: What it is and Why it's Important

To alter the default domain, click on the repository settings tab, then click Pages under the Code and Automation section, and finally pick your custom domain.

Popular domain registrars include GoDaddy, Google Domains, and Namecheap, and you can configure DNS settings with your registrar to point the domain to your GitHub Pages URL.

Here are the three types of domains supported by GitHub Pages:

  • www subdomain (e.g., www.mysite.com)
  • Custom subdomains (e.g., portfolio.mysite.com)
  • Apex domains (e.g., mysite.com)

Once you've set up your custom domain, you can announce your new website on social media and start sharing your work with the world!

Fork the Template

You'll be redirected to your own personal copy of the project repository after clicking the Fork button in the upper right of the screen. This is where you can make modifications to the project.

Click the Fork button in the upper right of the screen to create your own personal copy of the project repository.

Here's an interesting read: Website Copy Audit

Customizing Your Website

By default, GitHub Pages deploys the content of your repository from the main branch. You can change this behavior if you'd like.

Credit: youtube.com, How to Host a Website on GitHub Pages Free (Custom Domain Setup Included)

To customize the deployment of your site, click on the repository settings tab and then select the Pages option from the left-hand side menu under the Code and Automation section.

In the Build and Deployment section, choose the branch (and optionally sub-directory) from which you would like GitHub Pages to deploy your website.

You can select any branch, but make sure to update your GitHub Pages settings accordingly.

Customizing Your Website

To customize your website, you'll first want to launch it on GitHub Pages. Once your website is live, you can make changes and customize it to your liking.

By default, GitHub Pages deploys content from the main branch. If you want to change this behavior, you can alter the deployment settings.

To do so, click on the repository settings tab. From there, navigate to the Pages section under Code and Automation.

Here are the specific steps to customize your deployment:

  1. Click on the repository settings tab.
  2. From the left-hand side menu, click Pages under the Code and Automation section.
  3. In the Build and Deployment section, choose the branch (and optionally sub-directory) from which you would like GitHub Pages to deploy your website.

With these simple steps, you can customize the deployment of your site and make it your own.

Custom Domain Setup

Credit: youtube.com, How to Setup Custom Domains | Bubble Tutorial

You can use a custom domain to give your website a more professional URL and brand. GitHub Pages supports three types of domains: www subdomain, custom subdomains, and apex domains.

To alter the default domain, click on the repository settings tab, then click Pages under the Code and Automation section, and finally, pick your custom domain in the Custom domain section.

Popular domain registrars include GoDaddy, Google Domains, and Namecheap. Look for affordable .com, .net, and .org options. You can also check out RecommendedDomains.com, which offers domains starting at $9 per year.

To set up a custom domain, configure DNS settings with your registrar to point the domain to your GitHub Pages URL. GitHub has documentation on setting up a custom domain, so be sure to check it out.

For side projects and personal sites, RecommendedDomains.com is a great option. They offer domains starting at $9 per year, which is a great value.

Upload Background Image

Credit: youtube.com, How to add background image in HTML and CSS | Coding Ninja

Uploading a new background image is a straightforward process. Click the "Upload files" button in Github to get started.

To upload your new background image, you'll need to select the file from your computer, specifically the background.jpg file. It's a good idea to double-check that you're uploading the correct file to avoid any mistakes.

Once you've uploaded the new background image, scroll down and click "Commit changes" to push your changes to the gh-pages branch. This is an important step to ensure your changes are deployed correctly.

It usually takes about 3-4 minutes for Github to build and deploy your changes, so be patient and let the process complete.

For more insights, see: Upload Website Free

Adding Content and Style

Create an index.html file, which will serve as the homepage for your site, and add some basic HTML to get started.

Keep the markup minimal for now, but consider adding a short bio, links to social profiles, featured projects, recent blog posts, an email newsletter sign up form, and more to your homepage.

You can also create an about.html page to share your story, skills, experience, education, and interests, or a contact.html page to provide ways for visitors to get in touch.

Related reading: Websites to Code Html on

Adding Site Content

Credit: youtube.com, Add content, style and publish your site

To add site content, start by creating an index.html file, which will serve as the homepage for your site. This file should contain basic HTML, keeping the markup minimal for now.

You can also create additional pages like about.html, contact.html, blog.html, or portfolio.html to showcase your work and personality. Consider adding a short bio, links to social profiles, and featured projects to your homepage.

The about page is a great place to share your story, skills, experience, education, and interests. Don't forget to include your contact information, such as an email address and social profiles, on your contact page.

Blog and portfolio pages are essential for demonstrating your work and expertise. You can also include an email newsletter sign up form on your homepage to keep visitors engaged.

Adding Site Styling

Adding Site Styling can be a game-changer for your website's look and feel. Create a styles.css file with site-wide styles and link it in the `` of your HTML.

Credit: youtube.com, How to Create Ghost Themes: #27 Adding Content Styles

For quick styling, consider using a GitHub Pages theme. You can also use Sass, CSS frameworks, or tools like Tailwind CSS for advanced customization.

Plain HTML is functional but boring, so don't be afraid to spice it up with some CSS. Tailwind CSS makes styling easy, so give it a try.

Your website's design is a reflection of your personality and skills, so take ownership and showcase your unique style.

Publishing and Viewing

You can access your GitHub website by opening a browser and typing in your website's URL, which is your username followed by .github.io. Just wait a minute or so and you should be able to view your page.

If you try to navigate to your URL right away, you'll get a 404 Error: Not Found. This is because GitHub needs some time to build your website after you push changes to the gh-pages branch.

Troubleshooting

If you've created a repository on GitHub, but it's not showing up as a website, check if you've selected the correct branch in the repository settings.

Credit: youtube.com, How to Fix 404 Page Not Found Error GitHub| GitHub Tutorial 2025

Make sure you've committed and pushed all your changes to the repository before trying to create a GitHub Pages site.

If you're getting an error message saying "Your site is not accessible", it might be because you've set the GitHub Pages source to a non-existent branch or directory.

Verify that your repository has a valid `CNAME` file in the root directory, which is required for custom domains.

Check the GitHub Pages documentation for troubleshooting tips and known issues.

Frequently Asked Questions

Is it free to host your website on GitHub?

Yes, hosting a static website on GitHub is free, thanks to GitHub Pages. You can publish your website without incurring any costs.

Is GitHub Pages worth using?

Yes, GitHub Pages is a reliable and secure hosting option for personal and business sites, offering full control over design and content management. With its robust features and flexibility, it's a great choice for building and maintaining a professional online presence.

Thomas Goodwin

Lead Writer

Thomas Goodwin is a seasoned writer with a passion for exploring the intersection of technology and business. With a keen eye for detail and a knack for simplifying complex concepts, he has established himself as a trusted voice in the tech industry. Thomas's writing portfolio spans a range of topics, including Azure Virtual Desktop and Cloud Computing Costs.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.