1

I've some hooks that I have stored in a custom_hooks folder and are part of remote repository stored in a centralized location. When other developer does a git clone of the repository, the scripts in the custom_hooks folder should be copied to the folder .git/hooks/ in his local system.
I've read that we can create script that would create a symbolic link between custom_hooks folder .git/hooks/.

Wondering how to execute the script or command as part of clone command?

Once a developer runs a git clone of the repository the custom hooks should be automatically copied to the .git/hooks/ without any manual intervention.

Could someone please help me.

Thanks in Advance !!!

manu endla
  • 301
  • 4
  • 19
  • @DawidFerenczy I've been through this earlier and it doesn't help me. To use this solution we have to manually copy the hooks to the local system and then use the git clone --template=/path/to/custom_scripts . – manu endla Mar 10 '17 at 13:34
  • 3
    @manuendla: that's correct, *and* it's *crucial* from a security point of view. Imagine I told you to `git clone .../torek/zorg.git`, and you did, and in `zorg.git` I had a post-checkout hook that encrypted your files and then demanded payment to get the key. If Git encrypted your files and demanded payment, what would you do? Fortunately, Git won't, so `git clone` is a safe operation. – torek Mar 10 '17 at 13:39
  • @torek, still, the question isn't a duplicate of the mentioned one and perhaps your comment should be the answer. – Alex Jul 08 '17 at 12:35

0 Answers0