Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a complete offline archive of a GitHub repository?

We have some repos that we no longer need to keep on GitHub. If we use GitHub's archiving feature, the repos actually stay online. What we'd like instead is a way to download an archive of all the content (including issue reports) for a given repository, put that repository archive in a long-term preservation system, and delete the repo from GitHub. This is more than simply backing up a repository in the sense of other similar questions on Stack Overflow, and is more like what BackHub can do. Is there a tool or set of procedures (beyond git clone) that will allow me to do this?

like image 221
mhucka Avatar asked Jan 31 '19 20:01

mhucka


2 Answers

python-github-backup can back up a single repository in an organizational account, as well as all repositories in an account. I have tried it on individual repositories, and it worked as hoped: using its --all option, it captures issues, labels, milestones, pull requests, and wiki pages, as well as the repo itself.

Googling "github-backup" leads to other similar tools, but most of the others seem to have fewer features than python-github-backup or haven't been updated for many years. However, I must admit I haven't explored the other options very carefully.

Tip: the essential ingredient in using Google to find a suitable tool seems to be to search for the words "github" and "backup" specifically, and not include "archive" as I was doing in my original search, or even use more elaborate search strings such as "how make backup github repository".

like image 182
mhucka Avatar answered Nov 15 '22 08:11

mhucka


If is preferable to use git clone --mirror, to get the full repo history and then

  • git bundle --all to get only one file (easier to store than a collection of files)
  • a long term storage system (example AWS S3)

Notes:

  • you might want to clone the associated GitHub wiki as well, if you have one.
  • that won't preserve your issues/Pull Requests
like image 42
VonC Avatar answered Nov 15 '22 09:11

VonC