Git post-receive hook not working properly

空扰寡人 提交于 2019-12-06 16:29:19
VonC

The problem is that GIT_WORK_TREE and/or GIT_DIR might not been properly set when executing gitstat within that hook.

Try setting them just before the gitstat command:

GIT_DIR=/home/<username>/<proyect-name>/.git
GIT_WORK_TREE=/home/<username>/<proyect-name>
gitstats ... 

Why those variables wouldn't be properly set?
See for instance "Calling 'git pull' from a git post-update hook"

Eventually we got our linux guru over and he noticed that the environment under which the git user runs is totally different when inside a hook.

That is a case where your <username> won't be the one you think when the hook is executed...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!