Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top