Wednesday, April 17, 2013

GIT - Use global hooks / templates

There is an opportunity to use global hooks. So how you set up it? The configuration option init.templatedir will help us in that.

At first you can check exist value:
git config --global --get-all init.templatedir

If there is exist some you can check it. But if it's empty you can set up it by your path:
git config --global init.templatedir 'c:\Program Files (x86)\Git\share\git-core\templates\'
You may have another path from non-Windows system and in this way this link might help you.
It remains only put you hooks files into hooks directory:
c:\Program Files (x86)\Git\share\git-core\templates\hooks
and run command:
git init
Don't forget you have set up only templates. This templates don't used directly. By the last one command templates will copied to your .git directory. Also exist files cannot be overwritten.  So when you've created new project for copy hooks you have to run git init.

That's all.
Post a Comment