Skip to content

Credentials for multiple git services

Andrew Bruce edited this page May 14, 2015 · 5 revisions

You need git credentials to be able to aggregate your various documentation sources. For example, if you are using both GitHub and Bitbucket to store different documentation sections, you need to configure git credentials so that both services can be accessed.

SSH protocol

The most straightforward way to manage git credentials is using the SSH protocol. This means that your sections' URLs look like [email protected]:myorg/myrepo or [email protected]:myaccount/myrepo. These would be specified in your book's config.yml like so:

sections:
- repository:
    name: [email protected]:myorg/myrepo
  directory: myfinaldirectoryname
- repository:
    name: [email protected]:myaccount/myrepo
  directory: anotherfinaldirname

In order to configure git access to these repos, we'd need each service (GitHub and Bitbucket) to have our public key. It's possible to have separate public keys for each service.

Create ~/.ssh/config to configure this. It must have read/write permissions for the user, and be inaccessible to all other users (this is chmod 0600 ~/.ssh/config).

~/.ssh/config should contain something like the following:

Host github.com
    IdentityFile ~/.ssh/my_github_id_rsa

Host bitbucket.org
    IdentityFile ~/.ssh/my_bitbucket_id_rsa