3

I decided to backup all my github data and found this: https://help.github.com/en/github/understanding-how-github-uses-and-protects-your-data/requesting-an-archive-of-your-personal-accounts-data

I managed to get the .tar.gz file and it seems to contain all my repositories but there is no source code in there. Judging by the size, it looks like some kind of archive in objects/pack/*.pack

Is there any way to access original source code?

johnymachine
  • 781
  • 2
  • 7
  • 28

1 Answers1

3

it looks like some kind of archive in objects/pack/*.pack

According to Download a user migration archive:

The archive will also contain an attachments directory that includes all attachment files uploaded to GitHub.com and a repositories directory that contains the repository's Git data.

Those might be bare repositories or bundles.
Once uncompressed, try and git clone one of those folders (to a new empty folder)

The OP johnymachine confirms in the comments:

git clone .\repositories\username\repository.git\ .\repository\

Meaning repository.git is a bare repo (Git database only, no files checked out)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • git clone .\repositories\username\repository.git\ .\repository\ works like a charm. – johnymachine Mar 04 '20 at 10:07
  • works most brilliantly, but I am only able to get master branch. How do I get all the branches? – Mayank Jul 06 '22 at 04:17
  • @Mayank Do a `git branch -avv` in your repository: you should see all remote branches listed as `origin/xxx`. A `git switch xxx` would update your repository with that branch content. – VonC Jul 06 '22 at 04:27
  • @Mayank If not, that means GitHub policy when exporting data is to export only the default branch. – VonC Jul 06 '22 at 04:28
  • Much Appreciated @VonC! your earlier solution worked. – Mayank Jul 06 '22 at 08:40