git 挂钩 post-更新似乎不起作用
the git hooks post-update seems not working
我希望我的 git 服务器可以自动结账,
所以我尝试使用
.git/hooks/post-update
内容是
#!/bin/bash
cd /htdocs
git reset --hard HEAD
但是没用
所以我在我的服务器上创建了一个脚本,其中包含这样的命令
在文件 "post-update" 中我写了
/bin/bash /cron/git #git is the script
当我 运行 bash 中的脚本时,它有效,但是当我推送到 git 时,它不起作用。
我服务器上的 git 版本是 2.4.0
我使用 centos 6 x64
脚本权限为4755,属于root:root
./git的权限为750,属于git:git
尝试GIT_WORK_TREE=.. git reset --hard
。
我希望我的 git 服务器可以自动结账, 所以我尝试使用 .git/hooks/post-update 内容是
#!/bin/bash
cd /htdocs
git reset --hard HEAD
但是没用 所以我在我的服务器上创建了一个脚本,其中包含这样的命令 在文件 "post-update" 中我写了
/bin/bash /cron/git #git is the script
当我 运行 bash 中的脚本时,它有效,但是当我推送到 git 时,它不起作用。
我服务器上的 git 版本是 2.4.0 我使用 centos 6 x64 脚本权限为4755,属于root:root ./git的权限为750,属于git:git
尝试GIT_WORK_TREE=.. git reset --hard
。