Last Updated: February 25, 2016
·
6.531K
· ruzz311

Global git templates (yes, that means hooks)

There are a few searches that explain how to do this, but in a long "I'm a super-developer" kind of way. I just wanted something quick I could reference next time I have to set up my machine / help someone.

Usually the default template library is found at /usr/share/git-core/templates

To see where your git templates are found you'll need to check your git config. To view your current config (like typing env but only for git):

git config -l

If you have a templates directory set you see the line
init.templatedir=/path/to/templates

Initially I did not have this set. There are a few ways you can set your templates directory. One way would be to add to your ~/.gitconfig (in your home directory).

[init]
    templatedir = /path/to/templates

You can also set this property from the command-line:

git config --global init.templatedir /path/to/templates

1 Response
Add your response

Hello!

This post seems very interesting to me. I just got to know GIT recently, and I would like to use some global git hooks that are applied for every repos.
Could you tell me more about how to use this in live environment?

over 1 year ago ·