I want my git server can checkout automatically, so I try to use the .git/hooks/post-update the content is
#!/bin/bash
cd /htdocs
git reset --hard HEAD
but it didn't work so i created a script on my server which includes such command and in the file "post-update" i wrote
/bin/bash /cron/git #git is the script
when I run the script in bash,it works,but when i push to the git , it dosn't work.
the git version on my server is 2.4.0 and i use centos 6 x64 the permission of script is 4755 and belongs to root:root the permission of ./git is 750 and belongs to git:git
Try
GIT_WORK_TREE=.. git reset --hard
.