git hooks : is there a clone hook?

No, there isn't any clone hook.


Since git version 1.6.3, the post-checkout hook runs on git-clone (when run without --no-checkout).

It is also run after git-clone[1], unless the --no-checkout (-n) option is used. The first parameter given to the hook is the null-ref, the second the ref of the new HEAD and the flag is always 1.

https://git-scm.com/docs/githooks#_post_checkout


ok, one way to do this is to use the clone --template option.

Specify the location where the client side hooks will be stored as value to the --template switch. The hooks are copied to the clone, and the post-checkout hook is fired immediately!


When you clone a remote repository, you can't run any client-side hooks because hooks are local to your working copy, and you're creating one from scratch. When you pull new changes from a remote repository, git will run your local post-merge hook if it exists.

There is nothing run on the server as the result of a pull operation. A push operation will trigger the servers's update and post-update hooks.

See the Git Book for more information.