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 git+https://github.com/mtucker502/glbackup.git

or run directly without installing:

uvx --from git+https://github.com/mtucker502/glbackup.git 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.0.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.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: glbackup-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 2166cf21d476bb11aff79a58ac88b4e398f6b539921a6f6c72cbc16b9ee37a57
MD5 ab0ab22574e68193d17d707165a99b71
BLAKE2b-256 5fc942ee1494048e6bb030a7f5dfc8b51a6fd9ff697f7b0a0a4068bd4fcc6fa6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: glbackup-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05fbcbdf9199e360c1832efebfc725c7f02558a0213b9f797b8933ecf4be1255
MD5 1e80eb7cab27d76cf1db05ea9822cb04
BLAKE2b-256 22ff502ce67c22a4604b65d8ff8593028883d7816cbc1b1cffaa76880dc7b9e9

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