简体   繁体   English

通过HTTP在Windows上Git。 接收后挂钩不起作用

[英]Git on windows over HTTP. post-receive hook not working

I have configured msysgit on Windows as a server over HTTP. 我已经在Windows上将msysgit配置为通过HTTP的服务器。 I have configured Apache server to forward the requests to git-http-backened.exe . 我已经配置了Apache服务器将请求转发到git-http-backened.exe When I cloned and tried to push to the server from remote PC, everything worked perfectly. 当我克隆并尝试从远程PC推送到服务器时,一切工作正常。 But the post-receive hook is not working. 但是post-receive挂钩不起作用。

I have added to post-receive 我已添加到接收后

#!/bin/sh
echo "Hook got triggered.." > c:/Repos/logs.txt

When I manually execute the script, I see the log getting printed. 当我手动执行脚本时,我看到日志正在打印。

But when I push it from a remote system, files are getting updated. 但是,当我从远程系统推送它时,文件正在更新。 Push is working fine but the hook is not being invoked it seems, as the log is not printed. 推工作正常,但似乎未调用该挂钩,因为未打印日志。

Permissions for post-receive are -rwxr-xr-x post-receive权限为-rwxr-xr-x

My post-receive used to send mails without any problem, when I configured git over SSH. 当我通过SSH配置git时,我的post-receive邮件可以正常发送邮件。 After changing git to work over HTTP, I am facing issues. 将git更改为可通过HTTP工作后,我遇到了问题。 I have no clue, what extra changes need to be done to make the hook work. 我不知道,需要做哪些额外的更改才能使钩子起作用。

xxx.git/.git/hooks folder. xxx.git/.git/hooks文件夹。

That wouldn't work: if the repo is a bare repo (as indicated by the naming convention xxx.git/ , ie a folder ending with .git ), then the hooks/ folder should be immediately below it. 那是行不通的:如果xxx.git/是一个裸xxx.git/ (如命名约定xxx.git/ ,即以.git结尾的文件夹),则hooks/文件夹应位于其正下方。

xxx.git/hooks

And when you setup a Git server, the best practice remains for that server to manage only bare repos. 而且,当您设置Git服务器时,最佳实践仍然是该服务器仅管理裸仓库。
See: 看到:

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

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