git hooks : is there a clone hook?

落爺英雄遲暮 提交于 2019-11-26 05:36:28

问题


We want to store some meta-information about the commit in an external database. During a clone or a checkout, this database should be referred and we copy the meta information to a file in the repo which is cloned. The database is required rather than just using a file is for the sake of indexing and searches etc ...

I thought if there is a clone hook, we could trigger this. I couldn\'t find the clone hooks in the sample in .git/hooks. is there one? is post-checkout hook the only possibility at client side?


回答1:


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!




回答2:


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.




回答3:


No, there isn't any clone hook.



来源:https://stackoverflow.com/questions/10228065/git-hooks-is-there-a-clone-hook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!