I made a template sale website (gatsby / react). I cloned my template GitHub repo and changed the remote origin to a new private repo, pushing to which works fine.
I deploy to gh-pages with npm srcipt "deploy": "gatsby build --prefix-paths && gh-pages -d public"
The first time I ran this command it seemed to stall so I control c
'd out of it. Now, when I try to deploy I get the error "fatal: A branch named 'gh-pages' already exists."
git branch -a
shows:
remotes/origin/HEAD -> origin/master
remotes/origin/gh-pages
remotes/origin/master
But there is not a gh-pages branch on gitHub.
I tried rm -rf node_modules/gh-pages/.cache
didn't work.
Also, git push origin --delete gh-pages
which gave
"error: unable to delete 'gh-pages': remote ref does not exist".
I uninstalled and reinstalled gh-pages.
fatal: A branch named 'gh-pages' already exists. · Issue #44 · gitname/react-gh-pages · GitHub Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
fatal: A branch named 'gh-pages' already exists. · Issue #15 · transitive-bullshit/react-modern-library-boilerplate · GitHub Have a question about this project?
“fatal: A branch named 'gh-pages' already exists.” Code Answer fatal: A branch named 'gh-pages' already exists. Shell/Bash answers related to “fatal: A branch named 'gh-pages' already exists.” fatal: remote origin already exists.
Delete the local branch gh-pages if exists and run the command again. If already exists a gh-pages in your local, git checkout --orphan gh-pages will fail.
I had to manually remove the folder node_modules/.cache/gh-pages
to get the deployment to work.
Prior to this I had tried git fetch --prune
, which removed remotes/origin/gh-page
. I don't know if pruning the branches was a necessary step or not.
Just manually deleting the folder node_modules/.cache/gh-pages
worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With