Docs

Learn

v.Latest
Documentation
GitHub Git Provider
Table of Contents

The GitHub Git Provider handles saving and deleting content to a GitHub hosted Git repository. It is configured as a parameter to the createDatabase function.

Looking for the code? Check out the GitHub repository.

Adding the GitHub Git Provider

import { GitHubProvider } from 'tinacms-gitprovider-github'
// database.{ts,js}
//...
export default isLocal ? createLocalDatabase() ? createDatabase({
gitProvider: new GitHubProvider({
branch: process.env.GITHUB_BRANCH,
owner: process.env.GITHUB_OWNER,
repo: process.env.GITHUB_REPO,
token: process.env.GITHUB_PERSONAL_ACCESS_TOKEN,
}),
// ...
})

GitHub Git Provider Options

Required Parameters

Option

Description

branch

The branch to save content to.

owner

The owner of the repo.

repo

The repo to save content to.

token

A Github Personal Access Token.

Optional Parameters

Option

Description

commitMessage

The commit message to use when saving content. Defaults to Edited with TinaCMS.

rootPath

This path will be prefixed to all paths. Usually only used in monorepos. Optional.

octokitOptions

Options passed to the Octokit constructor

Join the Herd!

Become part of our coding comunity and stay updated with the latest tips and news.