Why GIT reports “fatal: This operation must be run in a work tree” when exporting from bare repo?

*爱你&永不变心* 提交于 2019-12-05 22:01:04

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.)

VonC

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!