This content originally appeared on DEV Community and was authored by yuvaraj_11
Oh, this is weird :(
- After a long time, I planned to deploy my react app to github in a different path, so I removed the gh-pages branch from my previously deployed path.
Then, I tried to my deploy app.
Oh, I didn't expect this error should come up.
I had been trying to fix the issue for a while , but finally a simple trick did work well.
This is my script which I had it before the error was occurred.
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
I changed only the deploy script from
"deploy": "gh-pages -d build"
to"deploy": "gh-pages-clean gh-pages -d build"
.Then, I tried
npm run deploy
, now the gh-pages cache got removed and ready to capture new changes.After that, I changed the deploy script back to normal
"deploy": "gh-pages -d build"
.Now, I ran
npm run deploy
, now it worked like a charm :)
This content originally appeared on DEV Community and was authored by yuvaraj_11
yuvaraj_11 | Sciencx (2022-04-14T12:38:45+00:00) Fixed ‘fatal: Couldn’t find remote ref refs/heads/gh-pages’ after running:git push origin :gh-pages’. Retrieved from https://www.scien.cx/2022/04/14/fixed-fatal-couldnt-find-remote-ref-refs-heads-gh-pages-after-runninggit-push-origin-gh-pages/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.