win+r,cmd,验证安装成功如下:
C:\Users\ASUS>node -v
v12.16.2
C:\Users\ASUS>npm -v
6.14.4
npm install -g gitbook-cli
验证(V大写):
gitbook -V
Typora编译器
创建书本文件夹
C:\Users\ASUS>d:
D:\>mkdir gitbook_books
D:\>cd gitbook_books
D:\gitbook_books>
D:\gitbook_books>gitbook init
win+e进入D:\gitbook_books,生成如下文件:
typora打开README说明文档,创建说明;
typora打开SUMMARY章节目录,设置目录;
注意:英文状态下输入[]和(),()内需与md文件名一致,[]章节名随意。
D:\gitbook_books>gitbook serve
Live reload server started on port: 35729
Press CTRL+C to quit ...
info: 7 plugins are installed
info: loading plugin "livereload"... OK
info: loading plugin "highlight"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "sharing"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 7 pages
info: found 31 asset files
info: >> generation finished with success in 2.3s !
Starting server ...
Serving book on http://localhost:4000
编辑完要访问gitbook4000接口查看效果,需要重新初始化并再次启动服务
所有内容编辑完毕后,在命令行中输入指令 gitbook build,生成如下:
首先,登陆GitHub,新建仓库,填写信息创建,然后复制地址。
重启cmd后需进入D:\gitbook_books>路径下,git clone + 刚刚在仓库中copy的GitHub地址
C:\Users\ASUS>cd /d d:\gitbook_books
d:\gitbook_books>git clone https://github.com/NightmareVix/My-poetry.git
Cloning into 'My-poetry'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
执行完毕后,在书文件夹下会产生一个与你项目名称一致的文件夹,到此文件夹下,将刚刚build后产生的文件全部拖入该文件夹:
git add .
进入命令行,cd到刚刚git帮我们创建好的GitHub仓库文件夹下,执行Git发布命令:
注意:若报错:git add “ Nothing specified nothing added ”
solution:You need to specify which files you want to add. Eg: git add filename.js
or git add .
to add all files.(.为英文状态下输入)
d:\gitbook_books>cd My-poetry
d:\gitbook_books\My-poetry>git add .
输入以下代码git commit -m "put the books in github"
git push弹出GitHub的登录窗口
d:\gitbook_books\My-poetry>git commit -m "put the books in github"
注意
第一次为github的登陆用户名和密码
第二次为下面截图操作步骤最终填写的note(用户名) 和生成的tokens(密码)
进入Github,setting——Developer settings——Personal access tokens,填写勾选,note直接填GIthub用户名,tokens复制上去
如果报错:fatal: HttpRequestException encountered.
解决方案:
由于 Client 有不同的解决方法:
Windows 系统直接在下述链接下载 .exe
文件即可:
https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/
Visual Studio Clients:
https://developercommunity.visualstudio.com/content/problem/201457/unable-to-connect-to-github-due-to-tls-12-only-cha.html
JDK:
https://blogs.oracle.com/java-platform-group/diagnosing-tls,-ssl,-and-https
Red Hat native Git clients:
https://www.linuxquestions.org/questions/blog/mensawater-183304/rhel5-wont-support-tlsv1-1-or-higher-36951/
详细的原因解释可参考:
“fatal: HttpRequestException encountered.” Error with GitHub/Bitbucket Repositories due to dropping TLS-1.0 support
最后成果:
一路跌跌撞撞,最后心情大好hhh