I have an archived git repository in tar.gz format containing .pack file in object folder.
How can I extract source code from it?
I have an archived git repository in tar.gz format containing .pack file in object folder.
How can I extract source code from it?
Packfiles are one of the ways that git stores objects (see "Unpacking Git Packfiles"). From your comments, it looks like the archive contains the contents of the .git
directory, in which case I'm guessing that the tarball also contains folders like info
and refs
in addition to objects
.
So to get the actual source code, just untar the folder:
tar -xvf archive.tar.gz
and move the contents to a directory named .git
. In other words, you should end up with a directory tree that looks like
myproject
|-- .git
| |--objects
| | |-- pack
| | | |-- pack-cdfae92.idx
| | | |-- pack-cdfae92.pack
That will "create" the repository in your current directory. You can confirm this by running git status
- it will say that you deleted a bunch of files. To repopulate the directory (ie, "undelete" the files), just run git checkout master
.