Home > OS >  Backing up GitHub organization repositories?
Backing up GitHub organization repositories?

Time:01-11

I am interested in backing up a GitHub organization repo. I have read that I can use the GitHub Rest API to create a POST request to create a migration archive. Once the archive is exported, I can send a GET request to download the archived repo as a .tar.gz to my local computer. Next I can then store the backup somewhere. https://docs.github.com/en/[email protected]/admin/user-management/migrating-data-to-and-from-your-enterprise/exporting-migration-data-from-githubcom

My question is when I create a migration archive, does this still keep the original GitHub.com repo? I am more interested in getting the .tar.gz compressed files then actually migrating the GitHub.com repo to something like GitHub Enterprise.

I am also a R user and stumbled on this blog post: https://ropensci.org/blog/2022/03/22/safeguards-and-backups-for-github-organizations/

CodePudding user response:

I ended up using the gitcellar R package and its download_organization_repos function.

This did exactly what I needed all in one-shot; archive (without locking) and download organization repositories (code, git history and metadata such as issues and PRs) as .tar.gz files to my local computer.

This workflow does keep the original repo, as the goal is to backup a repo and not actually migrate it. download_organization_repos keeps the Github API argument lock_repositories as the default value of false. Therefore still keeping write access.

CodePudding user response:

when I create a migration archive, does this still keep the original GitHub.com repo

Yes, but only on GHE (GitHub Enterprise, on promise), which is why it is recommended to lock the repository during the migration, which means you can unlock it and keep using it once the migration process has completed.

On github.com, there is no real export beside cloning your repository (and cloning its associated wiki if you have one), and pushing it back.

  • Related