Make sure there is no other configuration file (beside package.json) which would still reference the old GitHub repository URL. Check your git config -l.

After your git init, make sure to make at least one new commit, and push to the corresponding new GitHub repository.

Answer from VonC on Stack Overflow
🌐
npm
npmjs.com › package › gh-pages
gh-pages - npm
January 2, 2025 - NODE_DEBUG=gh-pages npm run deploy · Note that this plugin requires Git 1.9 or higher (because it uses the --exit-code option for git ls-remote). If you'd like to see this working with earlier versions of Git, please open an issue. { ProcessError: fatal: A branch named 'gh-pages' already exists.
      » npm install gh-pages
    
Published   Jan 02, 2025
Version   6.3.0
Author   Tim Schaub
🌐
Stack Overflow
stackoverflow.com › questions › 78156763 › issue-with-npm-gh-pages-and-deployment
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. ...
🌐
Stack Overflow
stackoverflow.com › questions › 75253896 › react-i-cant-deploy-to-github-with-npm-run-deploy
reactjs - React - I can't deploy to github with npm run deploy - Stack Overflow
I tried to delete the "dist" and "dist-ssr" from my .gitignore but I was not able to solve this problem. and I added the "heroku-postbuild": "cd client && npm install && npm run build" to my scripts in my package.json, but still not works. I also tried to deploy to netlify, but I have got SEVERAL errors. ... When you say gh -d build it means you want to deploy the build folder. But I see that your output folder is dist and NOT build Try changing it as gh-pages -d dist
🌐
Latenode
community.latenode.com › other questions › npm
npm run deploy command fails when publishing React application to GitHub Pages - NPM - Latenode Official Community
July 18, 2025 - I’m having trouble getting my React app deployed to GitHub Pages using the gh-pages package. I’ve been stuck on this for almost a day now and can’t figure out what’s going wrong. Here’s what I did step by step: Create…
🌐
Stack Overflow
stackoverflow.com › questions › 70496779 › npm-run-deploy-not-working-for-gh-pages
'npm run deploy' not working for 'gh-pages'
June 19, 2022 - 5 Cannot deploy to with gh-pages with specific project due to error: cannot spawn sh: No such file or directory · 3 gh-pages -d build has failed when using npm run deploy for Github Pages
🌐
GitHub
github.com › meandavejustice › gh-pages-deploy
GitHub - meandavejustice/gh-pages-deploy: publish to gh-pages from package.json · GitHub
"post" an array of script names to run after "prep", but before add/commit/push · "noprompt" if this is set to true, the prompt will be bypassed and you will never need to confirm the commands before deploying. This repo uses gh-pages-deploy.
Starred by 208 users
Forked by 20 users
Languages   JavaScript 79.0% | HTML 11.2% | CSS 9.8%
🌐
npm
npmjs.com › package › gh-pages-deploy
gh-pages-deploy - npm
January 8, 2019 - To configure gh-pages-deploy all you need to do is specify a couple of things in your package.json (all of which are optional) ... "prep" an array of script names to run before pushing to github, this can be any script that you have declared in your "scripts" object in your package.json. "commit" a custom commit message to be used when committing to git · "post" an array of script names to run after "prep", but before add/commit/push
      » npm install gh-pages-deploy
    
Published   Jan 08, 2019
Version   0.5.1
Author   meandave
Find elsewhere
🌐
DEV Community
dev.to › yuribenjamin › how-to-deploy-react-app-in-github-pages-2a1f
How to deploy React App to GitHub Pages - DEV Community
August 10, 2021 - No problem git remote - v Will ... display nothing time to add the right one Happy Hacking ... Hi Ibrahim, Thanks for the fast reply! I did this: Trishas-MBP-2:src TrishaBernice$ git remote rm origin Trishas-MBP-2:src TrishaBernice$ git remote -v Trishas-MBP-2:src TrishaBernice$ git remote add origin git@github.com:trishabernice/portfolio.git Trishas-MBP-2:src TrishaBernice$ npm run deploy · and I still got this... Cloning into 'node_modules/gh-pages/.cache/gi...
🌐
freeCodeCamp
forum.freecodecamp.org › t › struggling-to-deploy-react-app-on-github › 237911
Struggling to deploy react app on GitHub - The freeCodeCamp Forum
November 4, 2018 - Well this is very annoying, I am trying to deploy my first React app built with create-react-app, I googled about how to do this and it looks like I’m missing something, I am following the commands shown in the terminal,…
🌐
GitHub
github.com › facebook › docusaurus › issues › 6270
`npm run deploy` now fails due to GitHub pages-build-deployment bot · Issue #6270 · facebook/docusaurus
January 5, 2022 - Run npm run deploy on the 'source' branch. This will build the site and commit it to the 'main' branch. View the GitHub Actions page: https://github.com/agilegardenclub/agilegardenclub.github.io/actions/workflows/pages/pages-build-deployment
Author   philipmjohnson
🌐
Stack Overflow
stackoverflow.com › questions › 45685068 › error-on-npm-run-deploy-with-gh-pages-and-create-react-app
reactjs - Error on npm run deploy with gh-pages and Create-React-App - Stack Overflow
August 15, 2017 - [email protected] deploy: `gh-pages -d build` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] deploy script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR!
🌐
Team Treehouse
teamtreehouse.com › community › deploy-to-ghpages-fails
Deploy to gh-pages fails (Example) | Treehouse Community
February 14, 2019 - npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! reactrouter@0.1.0 deploy: `gh-pages -d build` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the reactrouter@0.1.0 deploy script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /Users/doug5solas/.npm/_logs/2019-02-14T00_52_36_331Z-debug.log ... 0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'deploy' ] 2 info using npm@6.7.0 3 info using node@v10.13.0 4 verbose run-script
🌐
GitHub
github.com › facebook › create-react-app › issues › 5038
I couldn't run npm run deploy · Issue #5038 · facebook/create-react-app
September 20, 2018 - Cannot read property 'email' of null npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! color-recognition-depl@0.1.0 deploy: gh-pages -d build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the color-recognition-depl@0.1.0 deploy script. npm ERR! This is probably not a problem with npm.
Author   Geeeva
🌐
GitHub
github.com › gitname › react-gh-pages › issues › 112
npm run deploy not actually committing anything to gh-pages branch · Issue #112 · gitname/react-gh-pages
October 6, 2022 - I have an app where gh-pages is installed and the scripts are defined in package.json, and npm run deploy seems to run just fine, but nothing is actually committed or deployed to the gh-pages branch. I am trying to attach screenshots of ...