我遵循Git Pro书(http://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server)在Ubuntu上设置我的第一个git远程服务器。 后,我按照这个:Git - 推送失败/此操作必须在工作树中运行
$ git remote add origin [email protected]:/opt/git/inventory.git
$ git push origin Windows
我收到此消息:
Counting objects: 33, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (28,28) done.
Writing objects: 100% (33/33), 7.30 KiB | 0 bytes/s, done.
Total 33 (delta 13), reused 0 (delta 0)
To [email protected]:/opt/git/inventory.git
* [new branch] Windows -> Windows
但是,当我在远程服务器上键入git status
(在/opt/git/inventory.git/)我得到的错误消息fatal: This operation must be run in a work tree
远程存储库似乎不包含任何来自本地存储库的文件,并且当我将远程存储库克隆到不同的本地文件夹时,没有文件,只有.git文件夹。
我已经看过其他相关的问题就在这里:
fatal: This operation must be run in a work tree
Why am I getting the message, "fatal: This operation must be run in a work tree?"
Getting “fatal: This operation must be run in a work tree?” on bare repository
,但我,为什么发生这种情况不清晰,我能做些什么来补救它。
阅读“裸”存储库。根据定义,“裸”存储库没有工作树,没有检出文件。这是预期的行为。 – 2015-02-09 14:40:32