當(dāng)你在 gitbook.com 上創(chuàng)建了書本后,你需要推送一些內(nèi)容給它。你可以使用網(wǎng)頁(yè)編輯器或者命令行來(lái)做這件事。
如果你想要通過命令行來(lái)更新你的書本的話,你可以使用 GIT 來(lái)推送你的內(nèi)容。
每本書本都有一個(gè)相關(guān)聯(lián)的 Git HTTPS url。GitBook 的 git 服務(wù)器暫時(shí)還不支持 ssh 協(xié)議。
git url 的格式是:
https://git.gitbook.com/{{UserName}}/{{Book}}.git
git 服務(wù)器使用你基本的 GitBook 登錄來(lái)認(rèn)證你。當(dāng)提示的時(shí)候,輸入你的 GitBook 用戶名和密碼(你同樣可以使用你的 API token)。
為了避免每次 push 的時(shí)候輸入密碼,你可以將你的 GitBook 憑證添加到 ~/.netrc 文件里。將下面內(nèi)容添加到 ~/.netrc 文件中:
machine git.gitbook.com
login 用戶名或郵箱
password API-TOKEN或密碼
為了安全起見,我們推薦你使用 API TOKEN,你可以在 in your settings under "API" 找到它。
touch README.md SUMMARY.md
git init
git add README.md SUMMARY.md
git commit -m "first commit"
git remote add gitbook https://git.gitbook.com/{{UserName}}/{{Book}}.git
git push -u gitbook master
git remote add gitbook https://git.gitbook.com/{{UserName}}/{{Book}}.git
git push -u gitbook master
更多建議: