gh-pages icon indicating copy to clipboard operation
gh-pages copied to clipboard

ProcessError: fatal: A branch named 'test-pages' already exists.

Open rodneyrehm opened this issue 8 years ago • 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.

rodneyrehm avatar Nov 14 '15 15:11 rodneyrehm

Fallback to 0.11.0 resolve this issue for me.

lmk123 avatar Nov 30 '16 10:11 lmk123

If you get this error during a deploy, you might need to empty the cache

rm -rf node_modules/gh-pages/.cache

kevincolten avatar Jan 17 '17 23:01 kevincolten

@kevincolten Thanks. That fixed it

BerkeleyTrue avatar Jan 31 '17 20:01 BerkeleyTrue

@kevincolten It is the solution.

alireza-saberi avatar Feb 16 '17 00:02 alireza-saberi

@kevincolten thanks!

leonorpan avatar Feb 28 '17 22:02 leonorpan

@kevincolten thanks  😀

simonguo avatar Apr 06 '17 16:04 simonguo

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"

cpietsch avatar Jul 26 '17 14:07 cpietsch

@kevincolten Thank U 👍

LeeHao12 avatar Oct 01 '17 02:10 LeeHao12

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

wasabigeek avatar Aug 22 '20 05:08 wasabigeek