简体   繁体   English

git钩子后接收不起作用

[英]git hook post-receive not working

I trying to deploy some PHP code to the server with Git. 我试图使用Git将一些PHP代码部署到服务器。 I am using a GoDaddy server. 我正在使用GoDaddy服务器。 I have created the bare repository. 我已经创建了仓库。 In the hooks folder, I created a post-receive file and wrote the following code in it. hooks文件夹中,我创建了一个post-receive文件,并在其中写入了以下代码。

#!/bin/sh
GIT_WORK_TREE=/home/domain/public_html/website git checkout -f

I want the git repo to move the source code that I have just pushed to the website directory in public_html . 我希望git repo将刚刚推送到源代码的源代码移到public_html的网站目录中。 I changed the permission to 0775 . 我将许可更改为0775

However, my website directory still remains empty. 但是,我的website目录仍然为空。 What should I do? 我该怎么办?

Perhaps it's because you spelled " post-recieve " wrong? 也许是因为您拼写“ post-recieve ”错误吗? It should be post-receive (note the i and e after the c). 它应该是post-receive (注意c之后的i和e)。

Good point by jszakmeister. jszakmeister的观点。 Also, the hook file has to be executable. 同样,挂钩文件必须是可执行的。 Just do chmod +x post-receive for that. 只需为此执行chmod +x post-receive

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

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