繁体   English   中英

500内部服务器错误,在接收后挂接后裸露git repo

[英]500 Internal Server Error with bare git repo after post-receive hook

我认为这是在此专用服务器(使用cpanel)上设置Git的最后一个问题。

我已经在PC上创建了一个裸/home/cpaneluser/git-repos/ ,并将其放置在服务器上: /home/cpaneluser/git-repos/

编辑了/home/cpaneluser/git-repos/myproject.git/hooks/post-receive ,其内容是:

#!/bin/sh
GIT_WORK_TREE=/home/cpaneluser/public_html GIT_DIR=/home/cpaneluser/git-repos/myproject.git git checkout -f

我给它0764许可,以便所有者可以执行它。 似乎执行得很好,因为它确实确实按预期将我的回购文件放到了我的public_html目录中。

然后,我在浏览器中导航到该域,并收到一个内部服务器错误,其中包含通用,无用的错误消息The server encountered an internal error or misconfiguration and was unable to complete your request.

真正奇怪的是,如果我手动编辑位于Webroot“ public_html”中的“ index.php”文件,它似乎可以神奇地修复所有问题。 但是,进行此编辑会使get存储库与我的本地端不同步。

有谁知道为什么在运行“ post-receive”钩子后执行checkout -f后为什么出现Internet服务器错误。 我该如何解决呢?

谢谢。

添加umask 0022解决了我的权限问题。

#!/bin/sh
umask 0022
GIT_WORK_TREE=/home/cpaneluser/public_html GIT_DIR=/home/cpaneluser/git-repos/myproject.git git checkout -f

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM