Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Linux » GitHub Pages Deployment Guide
  • Gfeature
    How to install Googler on a Linux System Linux
  • create a Mapped Drive via GPO
    How to create a Mapped Drive via GPO Preferences Windows
  • ycx
    Install SysInternals from the Microsoft Store Windows
  • SA
    How to Create Service Accounts, Organisation Units and Active Directory Security Groups Windows Server
  • office365family
    How to Cancel Office 365 Family Subscription JIRA|Confluence|Apps
  • Azure logo
    Microsoft Azure Active Directory: How to setup Azure AD Tenant AWS/Azure/OpenShift
  • Screenshot
    Change Active Directory Domain name from dot local to dot com Windows Server
  • ADDS vs AD LDS
    Differences between AD LDS and AD DS Windows

GitHub Pages Deployment Guide

Posted on 29/02/202427/08/2024 Raphael Gab-Momoh By Raphael Gab-Momoh No Comments on GitHub Pages Deployment Guide
Screenshot-2024-02-28-at-11.17.41 PM

Discover the streamlined process of seamlessly transitioning your workload from a local environment to GitHub, followed by effortlessly hosting it on GitHub Pages. This comprehensive guide demystifies the steps involved in the Github pages deployment guide. Thereby, empowering you to showcase your projects with ease and efficiency on the web. Other useful guides can be found here Move Azure Resources between Subscriptions and How to Deploy Azure Resources Using Azure Bicep also Setup a Continuous Deployment Pipeline with AWS CodePipeline and How to Install Azure Storage Explorer on Windows

GitHub Pages serves as an innovative platform within the GitHub ecosystem, empowering users to effortlessly host static websites directly from their repositories. This dynamic service caters to a diverse range of needs, from showcasing personal portfolios to sharing project documentation and beyond.

By leveraging GitHub’s seamless integration and user-friendly interface, individuals and organizations alike can amplify their online presence with ease and efficiency.

Step1: Download and Configure git bash

We can download Gitbash. To ensure thorough tracking of every action taken on our files, it’s imperative to associate an identity with each operation, given that Git serves as our version control system. Below are the commands to configure Git:

Git config --global user.name [username]

The above command configures the username of the working environment

GitHub-Pages-Deployment-Guide-configure-username
username configure
Git config --global user.email[email]

The command above configures the email of the working environment

GitHub-Pages-Deployment-Guide-email-configured
email configured

Please see How to sync S3 Bucket with an EC2 instance, How to install Git on macOS, and how to use Command-Line on Git Bash and GitHub Desktop to PUSH local code to GitHub.

Step 2: Prepare the working environment

For every project, the initial step is to create a directory that will contain all project files, and this project is no different. To create a directory, you can use the following command:

mkdir techdirectwebsite
GitHub-Pages-Deployment-Guide-directory
directory created

Enter into the newly created directory with the command:

cd techdirectwebsite
GitHub-Pages-Deployment-Guide-cd
cd

To initialize the directory with Git, use the following command:

git init
GitHub-Pages-Deployment-Guide-git-init
git init

At this point, we need to create a text file called index.html that would be sent to GitHub pages. We can use the command below

touch index.html
GitHub-Pages-Deployment-Guide-touch
text file created

We can edit the index.html file using vim [name of the file] the command automatically opens the index.html file. We then need to be in insert mode by pressing I on the keyboard to be able to start editing the file

vim index.html
GitHub-Pages-Deployment-Guide-vim
index.html file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Resume</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
line-height: 1.6;
}
h1, h2, h3 {
margin-top: 0;
}
.container {
max-width: 600px;
margin: 0 auto;
}
.contact-info {
margin-bottom: 20px;
}
.contact-info p {
margin: 5px 0;
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>Your Name</h1>
<p>Web Developer</p>
<div class="contact-info">
<p>Email: [email protected]</p>
<p>Phone: 123-456-7890</p>
<p>Website: <a href="https://www.example.com">www.example.com</a></p>
<p>GitHub: <a href="https://github.com/yourusername">yourusername</a></p>
<p>LinkedIn: <a href="https://www.linkedin.com/in/yourusername">yourusername</a></p>
</div>
</header>

<section>
<h2>Education</h2>
<p>Bachelor of Science in Computer Science, University Name, Year</p>
</section>

<section>
<h2>Experience</h2>
<h3>Web Developer, Company Name, Date</h3>
<ul>
<li>Firstly, developed and maintained company websites using HTML, CSS, and JavaScript</li>
<li>Secondly, collaborated with team members to implement new features and improve user experience</li>
</ul>
</section>

<section>
<h2>Skills</h2>
<ul>
<li>Firstly, HTML</li>
<li>Secondly, CSS</li>
<li>Thirdly, JavaScript</li>
<li>Fourthly, Git</li>
<li>Finally, Responsive Web Design</li>
</ul>
</section>
</div>
</body>
</html>

Here is how to fix Git always asking for my Username and Password, and how to clone a repository and install software from GitHub on Windows.

Step 3: Clone the repo into git bash

To clone a repo, we must first create it on GitHub. Beforehand, navigate to the GitHub website, click on the + button, and then check the drop-down.

GitHub-Pages-Deployment-Guide-plus-button

After creating the repo, click on the code, the green button, and copy the HTTPS option

GitHub-Pages-Deployment-Guide-https
repo clone URL

To clone the repo in our local environment, we need to use the code :

git remote add origin URL < this is the https link from the repo>
git remote add origin https://github.com/raphgm/techdirectwebsite.git
GitHub-Pages-Deployment-Guide-remote
cloning the repo

Step 4: Push to GitHub

At this point, we can check the status of what is in our index.html file using the command

git status
GitHub-Pages-Deployment-Guide-status
git status

At this stage, let’s actively add the files to the staging area to initiate tracking for them. Utilize the git add command, and subsequently, check the status again to confirm that tracking has commenced. We can employ the following command to add the files to the staging area:

git add index.html
GitHub-Pages-Deployment-Guide-add
files added to the staging area

Use the command to add a commit message:

git commit -m "this is a commit"
GitHub-Pages-Deployment-Guide-commit
commit message

We can then push to GitHub using the command. Make sure you authenticate

GitHub-Pages-Deployment-Guide-auth
authenticated succeeded
git push origin master
GitHub-Pages-Deployment-Guide-authenticate
push succeeded
GitHub-Pages-Deployment-Guide-mas
index.html file

You can view the content of the index.html document just in case there is a correct or any mistake.

GitHub-Pages-Deployment-Guide-index-oages
the context of the file

Step 5: Prepare the pushed content for GitHub pages.

Navigate to the settings button of the repo and click on it and it will take you to the general settings page .

GitHub-Pages-Deployment-Guide-set
click on the settings button

Next, click on Pages under the general settings

GitHub-Pages-Deployment-Guide-settings
pages button

At this point, you are in the GitHub Pages home page. The first thing to take note of is, the source button select Deploy from a branch as the source .

The next thing to take note of is Branch. Select the branch that has the file that you want displayed on GitHub pages. In this part particular case, our source code was deployed to the master branch so we select master. Finally click on the save button.

GitHub-Pages-Deployment-Guide-pages-homepage
pages home page

After clicking on the save button, you will see something like whats on the page below:

GitHub-Pages-Deployment-Guide-pages-saved
saved

At this point, you need to refresh the page to retrieve the URL of the rendered index.html document to GitHub pages

GitHub-Pages-Deployment-Guide-final-rendered-page-with-url
URL

Finally, navigate to the URL https://github.com/amazingraphael/techdirectwebsite generated for you or hit the Visit site button to visit your new static webpage hosted on GitHub pages. The page is shown below:

GitHub-Pages-Deployment-guide-final-page

Summary

GitHub Pages provides a versatile platform for hosting single-page documents like resumes or online stores, as well as sign-up pages. This article outlines the step-by-step process, from setting up your local environment to pushing your source code to facilitate seamless deployment.

I hope you found this article on Github pages deployment guide useful. Please feel free to leave a comment below.

5/5 - (1 vote)

Thank you for reading this post. Kindly share it with others.

  • Click to share on X (Opens in new window) X
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Nextdoor (Opens in new window) Nextdoor
Linux, Version Control System

Post navigation

Previous Post: Install SQL Server 2022 Express and SQL Server Management Studio
Next Post: How to create an EC2 Instance

Related Posts

  • mgithub
    How to use Command-Line on Git Bash and GitHub Desktop to PUSH local code to GitHub Version Control System
  • Docker Volumes
    Create and Mount Volume to Docker Container Containers
  • MM
    How to install Mattermost on Ubuntu and Debian Linux
  • feature linux boot process
    Linux Boot Process Explained Step by Step for Beginners Linux
  • Slide1
    Read-only Files: Saving Files in VIM Editor on Linux/Unix-like OS Linux
  • ArchiveUnarchiveDelete134
    Manage a GitLab Project: How to archive or unarchive and delete GitLab projects Version Control System

More Related Articles

mgithub How to use Command-Line on Git Bash and GitHub Desktop to PUSH local code to GitHub Version Control System
Docker Volumes Create and Mount Volume to Docker Container Containers
MM How to install Mattermost on Ubuntu and Debian Linux
feature linux boot process Linux Boot Process Explained Step by Step for Beginners Linux
Slide1 Read-only Files: Saving Files in VIM Editor on Linux/Unix-like OS Linux
ArchiveUnarchiveDelete134 Manage a GitLab Project: How to archive or unarchive and delete GitLab projects Version Control System

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a

  • Gfeature
    How to install Googler on a Linux System Linux
  • create a Mapped Drive via GPO
    How to create a Mapped Drive via GPO Preferences Windows
  • ycx
    Install SysInternals from the Microsoft Store Windows
  • SA
    How to Create Service Accounts, Organisation Units and Active Directory Security Groups Windows Server
  • office365family
    How to Cancel Office 365 Family Subscription JIRA|Confluence|Apps
  • Azure logo
    Microsoft Azure Active Directory: How to setup Azure AD Tenant AWS/Azure/OpenShift
  • Screenshot
    Change Active Directory Domain name from dot local to dot com Windows Server
  • ADDS vs AD LDS
    Differences between AD LDS and AD DS Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,836 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

Active Directory AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.