0

First of all, I am aware there are many similar questions out there, for example this one.

However, usually there are 2 main problems:

1.The hook file is not executable - checked. Here is the result of my ls -l:

-rwxrwxr-x 1 root root  314 Sep 29 17:18 post-update

2.git working directory not set -checked. Here is my post-update hook script:

unset GIT_DIR
cd ..
echo "testing"
chmod -R 755 path/to/my/target/directory

And, even if my path is wrong, I would expect seeing the word testing when I do git pull, but nothing happens. I guess this means my post-update hook script is not run? What have I missed to make it running?

cytsunny
  • 4,838
  • 15
  • 62
  • 129
  • `post-update` is a hook that's deployed and runs in the remote repository, so `git pull` can't invoke it. If you local repository has `post-update` installed, then a successful push from another repository to the local repository can trigger it. – ElpieKay Sep 29 '17 at 09:37
  • @ElpieKay You are right. I should use `post-merge` instead. Mind making it an answer so that I can accept it? – cytsunny Sep 29 '17 at 11:01

1 Answers1

-2

add: add --chmod=+x / --chmod=-x options

The executable bit will not be detected (and therefore will not be set) for paths in a repository with core.filemode set to false, though the users may still wish to add files as executable for compatibility with other users who do have core.filemode functionality. For example, Windows users adding shell scripts may wish to add them as executable for compatibility with users on non-Windows.

Although this can be done with a plumbing command (git update-index --add --chmod=+x foo), teaching the git-add command allows users to set a file executable with a command that they're already familiar with.