In our Git repository, after pulling files from origin to local, it is absolutely crucial to run another script which does some synchronizing. However, as programmers (including me) are prone to forgetting even crucial things, I think I'd better of writing a tiny bash script:
git pull origin master
# do our synchronizing stuff
However, that would still not solve the problem: Any developer could still do plain git pull
without using the script. So, what I have in mind is: Setting up the Git repository so that in only allows pull with a special parameter. If the special parameter is not present, it would return a custom message. Like so:
git pull origin master -special-parameter
# do our synchronizing stuff
Doing git pull origin master
without -special-parameter
would end in git pull not allowed directly. Please use our special script.
Is this possible?
The only solution coming to my mind is changing user rights, revoking all rights for the repository, only granting special_script_user
full rights and wrapping the git pull
inside su -c
. However, that would not be really elegant.