Existence of a pre-existing branch named gh-pages leads to fatal error

If your GitHub Pages site renders from a specific branch, then that’s where you should make changes and push them to GitHub. A common workflow for making changes to a branch involves checking it out using a command, making the necessary changes, staging the changes you wish to commit, and creating a new commit.

Solution 1:

To make the deployment function properly, I had to delete the node_modules/.cache/gh-pages manually.

I attempted to remove “remotes/origin/gh-pages” using “git fetch –prune” earlier. It’s unclear whether pruning the branches was an essential action.

Solution 2:

To remove the


on Windows, you can either run

rm -rf node_modules/.cache/gh-pages

or navigate to

node_modules folder


Solution 3:

Deleting the node_modules/.cache/gh-pages manually proved to be effective.

Frequently Asked Questions

Posted in Git