ProcessError: fatal: A branch named 'test-pages' already exists.
Opened this issue ยท 9 comments
Hey there,
I wanted to test this tool on a local branch before having things thrown at the remote gh-pages. For that reason I created a local branch off of gh-pages and called it test-pages - it has no upstream. When running gh-pages with the following options, I get an error thrown at me
{
branch: 'test-pages',
push: false,
message: 'chore(website): pushing website to test-pages',
}
and the error I see is
{ [ProcessError: fatal: A branch named 'test-pages' already exists.
]
code: 128,
message: 'fatal: A branch named \'test-pages\' already exists.\n',
name: 'ProcessError' }
I have then pushed test-pages
to the remote and tried again. This time I did not see an error, however the local test-pages
did not contain any updates. I then removed the push: false
option and tried again. There was no error, the local test-pages
did not show any changes, but the remote test-pages
had the proper content!
It is possible I've misunderstood how to use the options branch
and push
, but at the moment I fear the docs don't match reality.
Fallback to 0.11.0 resolve this issue for me.
If you get this error during a deploy, you might need to empty the cache
rm -rf node_modules/gh-pages/.cache
@kevincolten Thanks. That fixed it
@kevincolten It is the solution.
@kevincolten thanks!
@kevincolten thanks ๐
rm -rf node_modules/gh-pages/.cache
fixed it but if you deploy to 2 different branches you will run into this problem again.
I ended up doing it like that:
"predeployLive": "npm run build",
"deployLive": "npm run cleanup && gh-pages -d build -b deploy -e build",
"cleanup": "rm -rf node_modules/gh-pages/.cache"
@kevincolten Thank U ๐
In case anyone gets stuck with v3.1.0
, the cache directory is now at node_modules/.cache/gh-pages
https://github.com/tschaub/gh-pages/blob/v3.1.0/changelog.md#v310