I found out that you don't need the build script or the pre-deploy script. they are unnecessary to be used, since my website is static, I can navigate directly to the build folder and it will work fine.

I have modified the config.json file to be as in the following

{
    "name": "AmrAhmed",
    "version": "1.0.0",
    "description": "",
    "main": "truffle.js",
    "directories": {
        "test": "test"
    },
    "scripts": {
        "dev": "lite-server",
        "test": "echo \"Error: no test specified\" && exit 1",
        "deploy": "gh-pages -d src"
    },
    "author": "",
    "license": "ISC",
    "devDependencies": {
        "gh-pages": "^3.0.0",
        "lite-server": "^2.5.4"
    }
}

run the command npm run build

and it will be deployed to Github pages.

Answer from Amr on Stack Overflow
🌐
npm
npmjs.com › package › ghpages
ghpages - npm
February 10, 2017 - A command-line tool to easily deploy your current working branch to GitHub Pages.. Latest version: 0.0.10, last published: 10 years ago. Start using ghpages in your project by running `npm i ghpages`. There are 8 other projects in the npm registry ...
      » npm install ghpages
    
Published: Feb 10, 2017
Version: 0.0.10
🌐
npm
npmjs.com › package › github-pages
github-pages - npm
npm tokens that bypass 2FA are being restricted — account changes (Aug 2026) and direct publishing (Jan 2027). Learn how to prepare →× ... Tool for publishing gh-pages the pro way.
      » npm install github-pages
    
Published: Apr 07, 2016
Version: 3.0.2
Discussions

github - How to deploy npm project to gh-pages - Stack Overflow
I'm trying to deploy a website to gh-pages using npm. I'm using blain HTML and CSS and asynchronous javascript. I haven't used any SPA framework (react or angular). I'm currently using lite server ... More on stackoverflow.com
🌐 stackoverflow.com
Hosting on GH Pages
What do you mean by “won’t show my content”? Do you get a blank page when you open the page? If so, check for the hints in the console/network tab of your browser. Hard to debug with you when all we get it is “won’t show my contect”. More on reddit.com
🌐 r/webdev
7
2
June 9, 2023
github actions - Issue with npm gh-pages and deployment - Stack Overflow
I've been dealing with an issue when using the gh-pages npm module wherein running npm run deploy is not triggering deployment on GitHub reliably - sometimes it works, most of the time it doesn't. ... More on stackoverflow.com
🌐 stackoverflow.com
How to deploy a project which has npm packages on GitHub pages?
Select Topic Area Question Body I have a project built with next.js and it has a few npm packages. I want to deploy it on GitHub pages, but GitHub pages ignore my packages, and deploy the pure HTML... More on github.com
🌐 github.com
1
2
April 29, 2023
🌐
Medium
yumingchang1991.medium.com › deploy-simple-react-app-on-github-page-using-npm-in-six-steps-96d5aab76ed6
Deploy Simple React App on Github Page Using NPM in Six Steps | by Yu-Ming, CHANG (he/him) | Medium
June 5, 2022 - npm run build goes through the files in development environment, and generate production files in another folder called build · gh-pages -d build pushes all files in a folder called build to a branch named gh-pages
🌐
npm
npmjs.com › package › @types › gh-pages
@types/gh-pages - npm
TypeScript definitions for gh-pages. Latest version: 6.1.0, last published: 3 years ago. Start using @types/gh-pages in your project by running `npm i @types/gh-pages`. There are 7 other projects in the npm registry using @types/gh-pages.
      » npm install @types/gh-pages
    
Published: Dec 21, 2023
Version: 6.1.0
🌐
GitHub
github.com › gitname › react-gh-pages
GitHub - gitname/react-gh-pages: Deploying a React App (created using create-react-app) to GitHub Pages · GitHub
In a previous step, the gh-pages npm package pushed the distributable version of the React app to a branch named gh-pages in the GitHub repository.
Author: gitname
🌐
GitHub
github.com › tschaub › gh-pages
GitHub - tschaub/gh-pages: General purpose task for publishing files to a gh-pages branch on GitHub · GitHub
And then to publish everything from your dist folder to your gh-pages branch, you'd run this: npm run deploy · There are three types of GitHub Pages sites: project, user, and organization.
Author: tschaub
Find elsewhere
🌐
DEV Community
dev.to › rohantgeorge › deploy-your-project-to-github-pages-using-gh-pages-1dlh
🚀 Deploy Your Project to GitHub Pages Using gh-pages - DEV Community
April 28, 2025 - First, you need to add gh-pages as a development dependency: npm install gh-pages --save-dev · This allows you to run deployment commands easily. GitHub Pages needs to know where your app will live.
🌐
Reddit
reddit.com › r/webdev › hosting on gh pages
r/webdev on Reddit: Hosting on GH Pages
June 9, 2023 -

Hello all!

I am attempting to host my portfolio on GH Pages. I've been attempting all day and it for some reason just won't show my content. I used React.js to build my website. I got annoyed so uninstalled gh pages and deleting anything to do with it that it could be almost like a "fresh start"

Most tutorials I have seen start a repo and set everything up first before starting to code, I am doing the opposite, I am setting up gh-pages after completing my portfolio.

I feel like I have tried everything and nothing seems to work. If there are other hosting sites that you'd recommend are better that would be great!

I followed all steps below and even set the source to the gh-pages branch and it still wouldn't render my react app.

Step 1: Install gh-pagesvia the terminal, making sure you are in the correct file directory.

npm install gh-pages --save -dev(We are saving it as a dev dependency)

Step 2: Go to your package.jsonand add

"homepage": "<YOUR_GITHUB_USERNAME>.github.io/<REPO_NAME>,"above the "name"

Step 3: In the "scripts"section of package.jsonadd: "predeploy": "npm run build", "deploy": "gh-pages -d build",

Step 4: Assuming that you have already committed and pushed your code to your Git Repo, now, in the terminal, use the command npm run deployto see the changes in your GitHub Pages.

🌐
GitHub
pages.github.com
GitHub Pages | Websites for you and your projects, hosted directly from your GitHub repository. Just edit, push, and your changes are live.
Websites for you and your projects, hosted directly from your GitHub repository. Just edit, push, and your changes are live.
🌐
npm
npmjs.com › package › gh-pages
gh-pages - npm
January 2, 2025 - Removes files that match the given pattern (Ignored if used together with --add). By default, gh-pages removes everything inside the target branch auto-generated directory before copying the new files from dir.
      » npm install gh-pages
    
Published: Jan 02, 2025
Version: 6.3.0
🌐
Stack Overflow
stackoverflow.com › questions › 78156763 › issue-with-npm-gh-pages-and-deployment
github actions - Issue with npm gh-pages and deployment - Stack Overflow
"scripts": { "copy static files": "mkdir ./dist/static && cp ./src/img/IQS5xx.py.svg ./dist/static/", "dev": "npx parcel src/index.pug", "predeploy": "rm -rf .parcel-cache && rm -rf dist && npx parcel build src/index.pug --public-url 'https://github.com/JRiggles/jriggles.github.io' && cp CNAME ./dist && npm run 'copy static files'", "deploy": "npx gh-pages -d dist", "clean gh-pages cache": "node node_modules/gh-pages/bin/gh-pages-clean" },
🌐
Sean Coughlin
blog.seancoughlin.me › deploying-to-github-pages-using-gh-pages
Deploying to GitHub Pages using gh-pages
October 7, 2023 - Download the gh-pages package: you can use your favorite node package manager for this step. This module requires Git >= 1.9 and Node > 14. #NPM installation npm install gh-pages --save-dev # YARN install yarn add gh-pages --dev
🌐
npm
npmjs.com › search
gh-pages - npm search
gh-pages · js · npm · node · github · pages · cli · vue-cli · vue-gh-pages · github-pages · github pages · kiefersivitz• 1.19.1 • 6 years ago • 1 dependents • MITpublished version 1.19.1, 6 years ago1 dependents licensed under $MIT · 552 · deploy to gh-pages with one command ·
🌐
DEV Community
dev.to › caffiendkitten › setting-up-github-pages-with-react-2a13
Setting up Github Pages with React - DEV Community
March 16, 2021 - So now that my-portfolio is created navigate into that folder and run npm install gh-pages --save-dev to install the npm github pages package which will help create a gh-pagesbranch on Github and also serve our bundled react files on the branch.
🌐
npm
npmjs.com › package › angular-cli-ghpages
angular-cli-ghpages - npm
April 22, 2026 - angular-cli-ghpages compiles your app, then pushes the build output to a dedicated branch (default: gh-pages) – all with a single command: ng deploy. This branch serves as the source for your web host and works out of the box with GitHub Pages ...
      » npm install angular-cli-ghpages
    
Published: Jun 08, 2026
Version: 3.1.0