Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create the gh-pages branch if not existent #37

Closed
cironunes opened this issue Dec 6, 2015 · 7 comments
Closed

Create the gh-pages branch if not existent #37

cironunes opened this issue Dec 6, 2015 · 7 comments

Comments

@cironunes
Copy link

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)
@knownasilya
Copy link
Contributor

An easy step might be to check the failure, and print out the command they should run (it's in the readme).

@knownasilya
Copy link
Contributor

@cironunes do you think that would be a good solution in the short term?

@shak
Copy link
Contributor

shak commented Jul 21, 2017

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?

@shak
Copy link
Contributor

shak commented Jul 21, 2017

^ 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

@knownasilya
Copy link
Contributor

Good catch, think you can submit a PR?

@shahrukhomar
Copy link

Good catch, think you can submit a PR?

Sure, happy to leave a .gitkeep behind?

@knownasilya
Copy link
Contributor

Yeah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants