views:

473

answers:

2

Hi, if I export from bare GIT repository using git archive command I get error message: "fatal: This operation must be run in a work tree", altough the export passes properly.

So my question is: Is there any issue when exporting from bare repository? I checked the exported archive and it looks alright.

Thanks

+1  A: 

As mentioned in "backing up project which uses git", git bundle would be more appropriate.

git archive just creates tarballs of trees (snapshots) but doesn't preserve commits and history.

But you may be after a simple copy, and not the all history bundled in one file.

That being said, if git archive expect a working tree (as illustrated in "How to do a Git export"), its error message is expecting in a bare repo which, by definition, has no working directory.

VonC
I need to create an archive consisting of pure working copy, so git bundle is probably not usable. I can of course clone to normal (not bare) repository and call git archive in there, but I don't know if it's necessary, because git archive apparently works in bare repositories as well. I just don't know if the error message really means that the export could fail or if the message is there due to some historical reasons.
Daniel Milde
+4  A: 

I don't actually get that warning - I'm fairly certain it was a bug which was resolved sometime after the version you're using. I can't tell exactly when, because I haven't even managed to reproduce it at all (I tried v1.5.3.4, v1.6.2, and a build from current master.)

Jefromi
Try 1.6.0.3 ...
Charles Bailey
Ah, thanks. I get the message with git version 1.5.6.5 (Debian stable).
Daniel Milde