混帐后收到钩不运行下面推 [英] Git post-receive hook not running following push
问题描述
我托管在Amazon EC2实例(运行Ubuntu 12.04)网站。我希望能成为能够推动使用Git改变服务器,然后使用后收到钩在工作目录中检出。所以在hooks目录我有一个名为文件的服务器上后,收到一封包含:
I have a website hosted on an Amazon EC2 instance (running Ubuntu 12.04). I want to be able to be able to push changes to the server using git and then use a post-receive hook to checkout in the working directory. So on the server in the hooks directory I have a file named post-receive containing:
#!/bin/sh
GIT_WORK_TREE=/home/ubuntu/beta git checkout -f
该文件的权限:-rwxrwxr-X(即它是可执行的)
The file has the permissions: -rwxrwxr-x (i.e. it is executable).
在我的本地机器,当我推到服务器上的混帐回购协议,推动成功的混帐回购协议被更新。后收到钩但是没有运行。如果我手动运行挂钩,它运行良好并更新工作目录。
On my local machine, when I push to the git repo on the server, the push is successful and the git repo is updated. The post-receive hook is not run, however. If I run the hook manually, it runs fine and updates the working directory.
的混帐推进行了SSH和使用,就好像我是手动运行挂钩相同的用户。
The git push is carried out over SSH and uses the same user as if I were running the hook manually.
任何想法,为什么钩不会自动运行?
Any ideas why the hook will not run automatically?
感谢。
推荐答案
我已经成立了一个当地的相同的测试(即我从本地文件夹克隆),它工作正常。
I've set up an local identical test (ie I cloned from a local folder) and it works fine.
要查看该脚本在所有执行我添加了一个简单的触摸,看它是否修改的文件
To see if the script is executed at all I've added a simple touch to see if it modifies any files
我的后收到看起来像这样
My post-receive looks like this
#!/bin/sh
touch /Users/raven/git_tests/live/.git/hooks/i_ve_been_run
GIT_WORK_TREE=/Users/raven/git_tests/live git checkout -f
请确保您的挂钩被命名为完全后收到
或将无法正常工作。
Make sure that your hook is named exactly post-receive
or it won't work.
这篇关于混帐后收到钩不运行下面推的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!