Backup your GitHub repositories now!
Over the past few days, I've been seeing a surge of posts on Twitter regarding GitHub account suspension.
This isn't new. In February 2024, even GitHub's co-founder and ex-CEO, Chris Wanstrath, had his account suspended. Of course, GitHub immediately responded and removed the suspension for him but the rest of us may not be so fortunate.
Here's a bunch of other such incidents
- A student lost access to their bachelor's thesis and work repositories for 2 months due to GitHub Education verification issues
- Developers waiting up to 120 days for appeal responses
- Account suspended when trying out Codespaces and no response for over a month
- Account suspended when submitting multiple bug reports
GitHub's automated systems can flag accounts without warning, and appeals can take months. The solution? Keep your own backups.
Backup with gickup
I'm using gickup to backup my repositories hosted on GitHub. I run it on Kubernetes as a CronJob, but you can also use gickup's built-in cron runner.
I schedule daily backups, which is sufficient since actively developed repos are typically already cloned on my machine.
I'm currently backing up to the local filesystem, which is backed up separately but gickup also offers backing up to various remotes like - GitLab, Gitea, Gogs, OneDev, Sourcehut, S3.
Setup
- Create a GitHub Personal Access Token with
repo
scope - https://github.com/settings/personal-access-tokens - Configure - create a
conf.yaml
with your GitHub username and backup destination
Here's my conf.yaml
source:
github:
- token: ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
user: adityathebe
exclude:
- adityathebe/DefinitelyTyped # too Large, idc
- DefinitelyTyped
destination:
local:
- path: '/data/github-backups'
structured: true
mirror: true
lfs: false # setting this true was 100x slower
Instead of providing the github token on the config file, you can also set the
GITHUB_TOKEN
env var.
Key points:
- Source: All my GitHub repositories (excluding a few large ones)
- Mirror mode: This backs up all git refs (branches, tags, and pull request refs)
- Structured: Creates organized folders for each repository
Once configured, it's completely hands-off.
Restoration
git clone gickup/github-backups/github.com/adityathebe/nvim.git
Cloning into 'nvim'...
done.
admin@truenas[/mnt/mega/aditya/backups]$