Skip to content

Configuration

Akash Rajpurohit edited this page Dec 22, 2024 · 17 revisions

Before using git-sync, you need to create a configuration file named config.yaml. The default path for the configuration file is ~/.config/git-sync/config.yaml.

Here's an example configuration file:

# Git Sync Configuration

# Repository settings
include_forks: false # Include forked repositories
include_wiki: true # Include wiki's
include_repos: [] # Include specific repositories
exclude_repos: [] # Exclude specific repositories
include_orgs: [] # Include repositories from specific organizations
exclude_orgs: [] # Exclude repositories from specific organizations
raw_git_urls: [] # Raw valid git URLs

# Authentication
username: <username>
tokens: [<token 1>]

# Server settings
backup_dir: /path/to/backup
clone_type: bare # Clone type: bare, shallow, mirror or full. Default: bare
cron: 0 0 * * * # run every 24 hours at 00:00
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: github
server:
  domain: github.com
  protocol: https
Field Description Required
username Your service username. Yes
tokens List of service personal access token. You can create a new token here. Ensure that the token has the repo scope. Yes
include_wiki Include wiki in your backup process along with the code. No (Default is true)
include_forks If set to true, forks of the user's repositories will also be backed up. Default is false. No (Default is false)
include_repos A list of repositories to include in the backup. If set then only these repositories will be backed up. No (Default is [])
exclude_repos A list of repositories to exclude from the backup. If set then all repositories except these will be backed up. No (Default is [])
include_orgs A list of orgs to include in the backup. If set then repositories only from these organizations will be backed up No (Default is [])
exclude_orgs A list of orgs to exclude from the backup. If set then all organization repositories except these orgs will be backed up. No (Default is [])
raw_git_urls A list of raw git URLs to sync No (Default is [])
backup_dir The directory where the repositories will be backed up. No (Default is ~/git-backups)
cron The cron expression to run the sync job periodically. No (Default is "")
concurrency Number of repos being synced concurrently. No* (Default is "5")
clone_type The type of clone you want to perform. Options are: bare, shallow, mirror or full No* (Default is bare)
retry The retry config. Allows user's to set a retry count and delay to auto-retry the failures during sync operations. No
platform The platform to use for syncing repositories. Currently, it supports github, gitlab, bitbucket or forgejo. No (Default is github)
server The server settings. This includes the domain and the protocol which is http or https No (Default is {"domain": "github.com", "protocol": "https"})
workspace The workspace name. Yes (only if the platform is bitbucket)

'*' means that currently it is not required while we are before v1 release to maintain backward compatibility, but that can change after v1 release.

Note: The include_repos, exclude_repos, include_orgs and exclude_orgs fields accept repository/organization name as well as glob patterns. The patterns supported are those defined by filepath.Match.

Here are some examples you can see for different configurations

Clone this wiki locally