4 ms·
New fear unlocked; Being blocked from my github account. Is there some easy way to mirror everything on GH to a NAS or something?
by Cort3z 4y ago
New fear unlocked; Being blocked from my github account.
Is there some easy way to mirror everything on GH to a NAS or something?
- hahnchen 4y agohttps://docs.github.com/en/repositories/archiving-a-github-repository/backing-up-a-repository https://docs.github.com/en/repositories/archiving-a-github-r... They say to use a marketplace app if you want an easy way. Or, you can get individual repo archives from their api: https://docs.github.com/en/rest/migrations/users?apiVersion=2022-11-28 https://docs.github.com/en/rest/migrations/users?apiVersion=...
- LeonM 4y agoThe source code itself is just Git, so you can 'git clone' it anywhere. Add that host to your origin(s) and just push it as you always do. However, other data such as tickets, PR history, gists, etc. will be a lot harder to keep in sync with another service. GH allows exporting all the data, per GDPR, but importing it somewhere else will probably not be possible.
- Havoc 4y agoLocal gitea can mirror repos
- 3np 4y agoSearch and you'll find various software doing it. If you just want a minimal shell thing for repos themselves, you can fetch a list from GH API for user X and clone them into destination `/home/X/repos` like so: $ curl -s https://api.github.com/users/X/repos?per_page=100 | jq -r 'map([.name,.clone_url]|@tsv)|.[]' | xargs -n2 sh -c '[[ -d $0.git ]] || git clone --mirror $1 /home/X/repos/$0.git' Then you can just put a cronjob to sync them like $ find /home/X/repos -maxdepth 1 -mindepth 1 -exec sh -c 'cd {} && git remote update' \; Replace /users/X with /orgs/Y for an org. Pagination for >100 repos is left as an exercise to the reader. Note that this will create mirror (bare) repos, so if you want to checkout you can e.g. git clone file:///home/users/X/repos/foo.git somewhere else. Bonus: If you want to have these mirrors available remotely and self-hosted, the official git book lays out your options pretty nicely: https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protoco... Easiest are probably git protocol (handled by git itself) or "Dumb HTTP" (just server these directories from a static HTTP server)