Update your book using GIT

When your book is created on gitbook.com, you need to push some content to it. To do so, you can use the web editor or the command line.

If you want to update your book from the command line, you can use GIT to push your content:

GIT Url

Each book is associated with a Git HTTPS url. The ssh protocol is not yet supported on the GitBook’s git server.

The format for the git url is:

  1. https://git.gitbook.com/{{UserName}}/{{Book}}.git

Authentication

The git server is using your basic GitBook login to authenticate you. When prompted enter your GitBook username and your password (you can also use your API token).

Saving your credentials

To avoid having to enter your password on each new push, you can add your GitBook credentials to your ~/.netrc file. Create or append to an existing ~/.netrc file something like below:

  1. machine git.gitbook.com
  2. login USERNAME-or-EMAIL
  3. password API-TOKEN-or-PASSWORD

We recommend using your API TOKEN for security reasons, you can find it in your settings under “API”

Create a new repository on the command line

  1. touch README.md SUMMARY.md
  2. git init
  3. git add README.md SUMMARY.md
  4. git commit -m "first commit"
  5. git remote add gitbook https://git.gitbook.com/{{UserName}}/{{Book}}.git
  6. git push -u gitbook master

Push an existing repository

  1. git remote add gitbook https://git.gitbook.com/{{UserName}}/{{Book}}.git
  2. git push -u gitbook master