Are git hooks pushed to the remote when I 'git push'?

slacy picture slacy · Aug 31, 2012 · Viewed 31.1k times · Source

If I create a new hook script in my local repository in repo/.git/hooks/post-commit and then I run "git push" are the hooks pushed to the remote? Then, when the other developers run "git pull" from the same origin will they get my new hooks?

Answer

Lily Ballard picture Lily Ballard · Aug 31, 2012

No. Hooks are per-repository and are never pushed. Similarly, the repo config isn't pushed either, nor is anything in .git/info, or a number of other things.

Pushing and pulling only exchanges branches/tags and commit objects (and anything reachable from a commit, e.g. trees, blobs).