r/bash • u/bonesf • Aug 02 '22
I've written bash script to backup GitHub repositories filtered by user
The backup script collects the Repository Clone URL, Name and Size using the GitHub api.
The Size variable determines if the Repo isn't empty.
It then rotates though the list cloning, fetching and pulling as required. It runs frequently storing to an old Raspberry Pi.
I decided to create this backup because I realised that Github is a single point of failure for storing code.
1
u/Mattshen52 Aug 03 '22
Add bitbucket as another remote and push there too
1
u/bonesf Aug 03 '22
You don't need to push to multiple remotes, they can sync repo between hosts. A while back I was using GitLab and had the repositories sync to BitBucket to integrate with Atlassian tools.
Instead of returning to syncing repo's between remotes I found this to be easier as it'll capture new repo's as they're created.
2
Aug 03 '22
same here. spin up a bog-standard local gitea docker image and let github and gitea sync.
this way you don't loose history, branches and all the goodness that comes with git.
9
u/waptaff &> /dev/null Aug 02 '22
git, by its very design from day 1, does not force you to centralize. It ain't previous-generation version control system like subversion, CVS nor RCS where there was no other practical way to work without a single point of failure.Github may be a single point of failure, but that'd mainly be for the bug tracker, PRs, wiki and other Github-only features.