GitHub Backup
Getting Started
  • Filtering
  • Query Parameters
  • Refspecs
  • GitHub Repos
  • GitHub Releases
  • GitHub Gists
Report an Issue
GitHub
Getting Started
  • Filtering
  • Query Parameters
  • Refspecs
  • GitHub Repos
  • GitHub Releases
  • GitHub Gists
Report an Issue
GitHub
  • Getting Started

    • Introduction
    • GitHub Enterprise
    • Telemetry
  • Reference

    • GitHub Repos
    • GitHub Releases
    • GitHub Gists
  • Advanced

    • Filtering
    • Query Parameters
    • Refspecs

Refspecs

In some cases you may wish to limit which git refs are backed up from a repository. This can be done by configuring the corresponding refspecs field in your backup properties based on the Git Refspec syntax.

For example, to only backup the main and develop branches from a repository, you would use the following configuration:

config.yaml
schedule: "0 * * * *"

backups:
  - kind: github/repo
    from: "repos/my-org/repo"
    to: /backups/work
    properties:
      refspecs: "+refs/heads/main:refs/remotes/origin/main,+refs/heads/develop:refs/remotes/origin/develop"

The default refspecs configuration is +refs/heads/*:refs/remotes/origin/* which will backup all branches from the repository and automatically update local copies in cases where the remote is force-pushed (i.e. not fast-forward updatable).

Edit this page
Last Updated:: 16/05/2025, 01:08
Contributors: notheotherben
Prev
Query Parameters