CodeThug
CodeThug

Reputation: 3192

Restoring a Git archive

I've followed the guides and managed to create a zip archive of my git repository, by doing this:

git archive HEAD --format=zip > c:\myarchive.zip

The reason I want to do this is that I'm done with the project, so I'm going to delete the VM I've been doing development on, but I want a backup of the work I've done so that I can refer to it later if I need to. However, I can't figure out how to open the zip file that is created.

Normally, I would double-click on a zip file to open it, but when I do, I see this error:

Windows cannot open the folder.
The Compressed (zipped) Folder 'C:\myarchive.zip' is invalid.'

I've tried recreating the zip file a couple of times, but it didn't change anything. Any thoughts?

Upvotes: 0

Views: 5637

Answers (4)

Smino_
Smino_

Reputation: 15

I had the same issue when trying to archive a git repo using powershell. Trying it with cmd, it worked like a charm.

Upvotes: 0

CB Bailey
CB Bailey

Reputation: 791849

WARNING git archive does not create an archive of yor git repository; it creates an archive file that contains a snapshot of the contents of the given commit.

To create a true archive (if you cannot reasonably just push to a safe repository) you should use git bundle and make sure to include all your branches.

Upvotes: 9

Toby Allen
Toby Allen

Reputation: 11213

unzip to a directory.

The git archive command seems to be one way and help you create a zip archive, but assumes use of a zip tool to unzip.

Upvotes: 1

Ian P
Ian P

Reputation: 1724

Not quite sure why you want to do this (apart from seeing if you can). If you are strugging with Git (it is a bit of a learning curve) there are some videos which we made when we were going through the same process. We recorded the guy who helped us... http://www.ava.co.uk/git Hope they help

Upvotes: 0

Related Questions