Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub


Version License Travis CI

A simple plugin for Gatsby that clones a remote Git repository before building. This will run git clone when you start Gatsby, with develop or build. If the repository already exists locally, it will update the repository to the latest commit.

This plugin can be used in combination with gatsby-source-filesystem to fetch content from a different repository, for example.


  • Node.js v10 or newer.
  • Git.


First, install the package using npm or yarn.

yarn add -D gatsby-plugin-git-clone


npm install --save-dev gatsby-plugin-git-clone

Getting started

To use the plugin, add it to your gatsby-config.js:

import { resolve } from 'path';

export default {
  // ...
  plugins: [
      resolve: 'gatsby-plugin-git-clone',
      options: {
        repository: 'https://github.com/foo/bar.git',
        path: resolve(__dirname, './foo')


gatsby-plugin-git-clone has a few options:

  • repository (required) - The remote repository to clone.
  • path (required) - The local path to clone the repository to.
  • branch (optional) - The branch to clone.
  • gitOptions (optional) - The options to pass to simple-git. See the simple-git documentation.
© 2023 Gatsby, Inc.