Skip to main content

Mirror-clone GitLab repositories to local disk

Project description

glbackup

mirror-clone GitLab repositories to local disk. uses glab CLI for API access (auth, pagination, tokens handled for you).

install

uv tool install glbackup

or run directly without installing:

uvx glbackup

requires glab authenticated (glab auth login).

usage

# back up all repos in a group
glbackup group my-org/my-group

# starred repos only
glbackup starred

# repos you're a member of
glbackup member

# repos you own
glbackup owned

# everything you can see
glbackup all

# only repos under your personal namespace
glbackup owned --include "username/*"

# preview what would be backed up
glbackup group my-org/my-group --dry-run

# list repos without backing up
glbackup list --group my-org/my-group

options

--backup-dir PATH       destination (default: cwd)
--protocol [ssh|http]   clone protocol (default: ssh)
--workers N             parallel clones (default: 4)
--dry-run               show what would be backed up
--include-wiki          also back up wiki repos
--include-lfs           fetch LFS objects
--skip-forks            skip forked repos
--forks-only            only forked repos
--exclude PATTERN       exclude by fnmatch (repeatable)
--include PATTERN       include only matching (repeatable)
--post-hook COMMAND     run after backup completes

backup layout

./
  .manifest.json
  group-name/
    subgroup/
      project-name.git/          # bare mirror
      project-name.wiki.git/     # wiki (optional)

working with backups

backups are bare repos (git clone --mirror) — no working tree, all branches/tags/refs preserved. to browse or build code from a backup:

# add a worktree (keeps the bare repo intact)
git worktree add ../my-working-copy main

# or convert to a regular repo
cd project-name.git
git config --bool core.bare false
git checkout main

other commands

glbackup status    # show backup state from manifest
glbackup verify    # git fsck on all mirrors

config

optional TOML config at ~/.config/gitlabbackup/config.toml:

backup_dir = "~/gitlab-backups"
protocol = "ssh"
workers = 8
gitlab_host = "gitlab.example.com"
exclude_patterns = ["archive/*"]

env vars: GLBACKUP_DIR, GLBACKUP_HOST, GLBACKUP_PROTOCOL, GLBACKUP_WORKERS

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glbackup-0.2.1.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glbackup-0.2.1-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file glbackup-0.2.1.tar.gz.

File metadata

  • Download URL: glbackup-0.2.1.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.16

File hashes

Hashes for glbackup-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c6313023c1639f6bd573ad1cd11977a3404971092da7a76ff654d701b9ab4dd5
MD5 368f659ed79b559db1e2494a5a63b052
BLAKE2b-256 09af1f9ab817eca5664c42cdb10ed4d3a5f9e716720efc02f3a7292a9cbdbcd5

See more details on using hashes here.

File details

Details for the file glbackup-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: glbackup-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.16

File hashes

Hashes for glbackup-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dbafe9896d21ed413329bc129b9b64302cf3f425087ca90d653d0c85c7a99ac3
MD5 2bdde7a774995afc530125075f3cb708
BLAKE2b-256 6290f21e622a6fea5385e8fefecf4a08158f0113889b05738ea47c173513906d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page