Skip to content

Examples

Akash Rajpurohit edited this page Feb 2, 2025 · 13 revisions

Basic Configurations

GitHub

username: your-github-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: []
exclude_repos: []
include_orgs: []
exclude_orgs: []
raw_git_urls: []
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: github
server:
  domain: github.com
  protocol: https

GitLab

username: your-gitlab-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: []
exclude_repos: []
include_orgs: []
exclude_orgs: []
raw_git_urls: []
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: gitlab
server:
  domain: gitlab.com
  protocol: https

Gitea

username: your-gitea-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: []
exclude_repos: []
include_orgs: []
exclude_orgs: []
raw_git_urls: []
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: gitea
server:
  domain: gitea.com
  protocol: https

Forgejo

username: your-forgejo-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: []
exclude_repos: []
include_orgs: []
exclude_orgs: []
raw_git_urls: []
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: forgejo
server:
  domain: codeberg.org
  protocol: https

BitBucket

username: your-bitbucket-username
tokens: [your-app-password]
workspace: you-bitbucker-workspace
include_wiki: true
include_repos: []
exclude_repos: []
include_orgs: []
exclude_orgs: []
raw_git_urls: []
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: bitbucket
server:
  domain: bitbucket.org
  protocol: https

NOTE: For BitBucket you need to also add the workspace key which is not required for GitHub or GitLab

Example configurations for different use-cases

Run the git-sync with cron

username: your-github-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: []
exclude_repos: []
include_orgs: []
exclude_orgs: []
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
cron: * * * * *
platform: github
server:
  domain: github.com
  protocol: https

Include all repositories that I own (even forks)

username: your-github-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: []
exclude_repos: []
include_orgs: []
exclude_orgs: []
backup_dir: /path/to/backup
include_forks: true
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: github
server:
  domain: github.com
  protocol: https

Include all repositories that I own excluding forks

username: your-github-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: []
exclude_repos: []
include_orgs: []
exclude_orgs: []
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: github
server:
  domain: github.com
  protocol: https

Include all repositories that I own excluding forks and some repositories

username: your-github-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: []
exclude_repos: ["repo1", "repo2"]
include_orgs: []
exclude_orgs: []
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: github
server:
  domain: github.com
  protocol: https

Include only specific repositories

username: your-github-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: ["repo1"]
exclude_repos: []
include_orgs: []
exclude_orgs: []
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: github
server:
  domain: github.com
  protocol: https

NOTE: In the above example if you passed exclude_repos as well then it will be ignored since you have passed include_repos. So an example like below will still have the same effect as above and only "repo1" will be backed up.

username: your-github-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: ["repo1"]
exclude_repos: ["repo2", "repo3"]
include_orgs: []
exclude_orgs: []
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: github
server:
  domain: github.com
  protocol: https

Include / Exclude repositories only from specific organizations

username: your-github-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: []
exclude_repos: []
include_orgs: ["org1", "org2"]
exclude_orgs: []
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: github
server:
  domain: github.com
  protocol: https

Similarly, you can exclude repositories from specific organizations:

username: your-github-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: []
exclude_repos: []
include_orgs: []
exclude_orgs: ["org1", "org2"]
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: github
server:
  domain: github.com
  protocol: https

NOTE: When you are using exclude_orgs option, it means that all organization repositories from the organizations mentioned in the list will be excluded from the backup. If you want to exclude only specific repositories from the organizations then you can use exclude_repos option.

Include / Exclude repositories using glob patterns

To include all repos which start with repo, you can use the following configuration:

username: your-github-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: ["repo*"]
exclude_repos: []
include_orgs: []
exclude_orgs: []
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: github
server:
  domain: github.com
  protocol: https

Same way, you can exclude all repos which start with repo:

username: your-github-username
tokens: [your-personal-access-token]
include_wiki: true
include_repos: []
exclude_repos: ["repo*"]
include_orgs: []
exclude_orgs: []
backup_dir: /path/to/backup
include_forks: false
clone_type: bare
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds
platform: github
server:
  domain: github.com
  protocol: https

Include Raw Git URLs

raw_git_urls: ['https://github.com/selfhst/icons']
backup_dir: /path/to/backup
clone_type: full
concurrency: 5
retry:
  count: 3
  delay: 10 # in seconds