Difficulty in getting GitBook site to show up in G

2020-05-24 09:50发布

I am trying to follow https://github.com/GitbookIO/gitbook but there is some assumed knowledge that clearly I don't have. I've used GitHub for some time but I've still got a lot to learn.

My goal is to have a GitHub page at http://martynchamberlin.github.io/GitBook/ that corresponds to this repository: https://github.com/martynchamberlin/GitBook.

So here's my question: how exactly is GitBook themselves doing this?

I assume (though it's not anywhere stated) that they are manually creating a gh-pages branch, because this magically turns a Github repo into a Github page.

To do this, I have followed the Github documentation at https://help.github.com/articles/creating-project-pages-manually

But here's my problem: all of the HTML (index.html, etc) is located at /_book/ instead of in the parent directory of the gh-pages branch. Which means that when I load https://github.com/martynchamberlin/GitBook, I'm getting a 404.

Note that when I run gitbook serve locally, I see what I'm supposed to when I fire up my browser at localhost:4000.

I'm sure I'm missing something simple here. Any ideas?

Thanks, Martyn

3条回答
我命由我不由天
2楼-- · 2020-05-24 10:11

for people who still have issues using the command above, here is my scenario.

I used to use tortoise-git on my windows machine to manage my github projects, and they are totally fine tool to use. But when it comes to gitbook publish command, it somehow stuck in the middle of switching between branches etc...

My solution is to download the github windows client, and it has this git shell come with it , if you run the gitbook publish command against the github suite git tooling, everything works fine.

查看更多
萌系小妹纸
3楼-- · 2020-05-24 10:29

Regarding the gh-pages branch, you are correct, it can be found here:

https://github.com/GitbookIO/git/tree/gh-pages

It does indeed have an index.html file in the root directory:

https://github.com/GitbookIO/git/blob/gh-pages/index.html

查看更多
Bombasti
4楼-- · 2020-05-24 10:31

Take a look at this book: https://github.com/GitbookIO/git.

It uses grunt to set up a few tasks: test, publish and build.

You should do the same by copying the package.json, Gruntfile.js and running:

$ npm install .

For testing:

$ grunt test

For publishing on the gh-pages branch:

$ grunt publish
查看更多
登录 后发表回答