Why GIT reports "fatal: This operation must be run in a work tree" when exporting from bare repo?
if I export from bare GIT repository using git archive command I get error message: 开发者_StackOverflow"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.
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.)
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.
精彩评论