Answer the question
In order to leave comments, you need to log in
Confused about GIT permissions when executing a hook?
Such is the situation.
We have a repository on the server /var/www/git/repository/testdeploy.git
We have the following hook (post-update)
unset GIT_DIR
export GIT_WORK_TREE=/var/www/testdeploy
cd /var/www/testdeploy && git pull origin master
drwxrwxr-x 3 httpd httpd 4096 июня 10 22:08 testdeploy
[email protected]:/var/www$ groups git
git : git httpd
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 309 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: error: cannot open .git/FETCH_HEAD: Permission denied
To http://git.initdev.lan/dexter/testdeploy.git
6817616..88d2fc2 master -> master
-rwxrwxr-x 1 httpd httpd 105 июня 10 22:02 FETCH_HEAD
Answer the question
In order to leave comments, you need to log in
Under another user, I do it from my computer remotely. That's the problem I checked, it comes to the hook.
I checked it by simply writing echo “Something” in the hook file (post-update)
git updates the branch in the repository /var/www/git/repository/testdeploy.git and then executes the hook and falls out on the command
git pull origin master
If written by the owner git for the /var/www/testdeploy directory, then everything is OK. One gets the feeling that when executing the hook,
git does not understand that it is in the httpd group.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question