Home > Blockchain >  Deploying to user page with gh-pages throws a fatal: A branch named 'master' already exist
Deploying to user page with gh-pages throws a fatal: A branch named 'master' already exist

Time:12-19

I'm trying to deploy my React webpage to the GitHub user level hosting so that the homepage url doesn't end up having any extra paths. In other words I want the url to be just [username].github.io

I've been following the create-react-app documentation, and the part that talks about deploying to the GitHub user page has this snippet:

"scripts": {
    "predeploy": "npm run build",
-   "deploy": "gh-pages -d build",
    "deploy": "gh-pages -b master -d build",

when I try to run npm run deploy at the final stage of the compilation I get the
fatal: A branch named 'master' already exists. error

I haven't encountered any issues hosting it on a project level ([username].github.io/[repository_name]) but I keep coming up short with this particular setup

CodePudding user response:

Its a cache issue. Just manually delete the folder node_modules/.cache/gh-pages. and deploy again.

  • Related