Create the gh-pages branch if not existent
cironunes opened this issue · comments
if you just try to deploy without creating the branch first it will fail
Command failed: /bin/sh -c git checkout gh-pages
error: pathspec 'gh-pages' did not match any file(s) known to git.
Error: Command failed: /bin/sh -c git checkout gh-pages
error: pathspec 'gh-pages' did not match any file(s) known to git.
at ChildProcess.exithandler (child_process.js:203:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:818:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:469:12)
An easy step might be to check the failure, and print out the command they should run (it's in the readme).
@cironunes do you think that would be a good solution in the short term?
I get the same error even after creating the orphan branch. I haven't looked at the code in detail yet but the error tells me the command that checks out the orphan branch isn't correct i.e. instead of running:
git checkout gh-pages
it should be running:
git checkout --orphan gh-pages
Reference: https://git-scm.com/docs/git-checkout
Does this makes sense?
^ false alram,
I think it's rather:
git checkout --orphan gh-pages && rm -rf `bash -c "ls -a | grep -vE '\.gitignore|\.git|node_modules|bower_components|(^[.]{1,2}/?$)'"` && git add -A && git commit -m "initial gh-pages commit"
the rm -rf
removes everything from the new orphan branch, so when you run git add -A
there are no files to stage and subsequently nothing to commit which results in no gh-pages
branch being created.
I got around the issue by leaving behind a .gitkeep
Good catch, think you can submit a PR?
Good catch, think you can submit a PR?
Sure, happy to leave a .gitkeep
behind?
Yeah