我已使用此 Git 设置来管理网站:http ://toroid.org/ams/git-website-howto 。
一切正常,直到我激活了接收后挂钩。在激活它之前,我可以毫无问题地推拉。但是,如果我激活钩子,它会说:
fatal: /usr/bin/git-checkout cannot be used without a working tree.
error: hooks/post-receive exited with error code 1
它仍然可以正确拉动,但不会像预期的那样复制文件(到 webroot)。但是 post-receive 钩子上写着:
#!/bin/sh
GIT_WORK_TREE=/home/domains/mydomain/html/ git checkout -f
那么为什么 git 抱怨没有工作树呢?相同的语法适用于其他网站。