I have a requirement where I want to symlink git hooks after the clone is successfully completed. I tried creating post-checkout hook in mylocalrepo/hooks directory. I want symlink of hooks in mylocalrepo/hooks to be automatically created under mylocalrepo/.git/hooks after clone is successful.
But how will git get to know about the existence of the original hooks under mylocalrepo/hooks directory when initially no symlink relation exists between mylocalrepo/hooks and .git/hooks, when we clone the repo.
Is there a way I can implement a hook that would trigger after the clone?
If at all there is a post-clone-like-hook, which I haven't found till now, then how does one go about making git aware of it, as hooks are not inherited during clone,and a cloned repo has only sample hooks, and for custom org-enforced hooks(hooks under mylocalrepo/hooks directory) to work, we need to get the symlink relation established first.
Creating symlinks can be done manually by each developer after the clone is successful, but is there any way to automate this process as well so that the symlinks are created(or any other task which is required to be performed on successful clone) gets executed after the clone is successful.
Found below OPs, but none seem to solve my issue:
git hooks : is there a clone hook? : here it is suggested to use the clone --template
option and that the template should already exist on the filesystem beforehand and as I'm on windows, I have not been able to figure out where this template directory resides on Windows filesystem.
git-clone and post-checkout hook : This also doesn't help.I just am not able to see the solution there, though the OP has accepted answer. how the symlink relation is established, when there are only sample hooks when someone clones a repo.
Automatically run tasks after Git Clone without using git hooks : This also doesn't help, as what I want is to have a standard way of performing the post -clone action, where the user/developer doesnot have to bother about setting up thesmlinks. He will just clone the GitHUb repo and everything else will be taken care of.
Possible solution : to have a script distributed among developers or included in teh GitHub repo and ask the devs to execute the script after the clone. But, as I said I want to make this an automatic process.
Please let me know if I missed out on anything.
EDIT 1 : START
Some might say that this is a possible duplicate of the other posts that I mentioned in my post. This might sound duplicate but isn't. If I'm not able to apply what has been suggested in the other OPs(dating back to 2010), then what good it does to me if someone marks my question as duplicate, moresoever when I post my questions against each of the OPs link asking for clarifications as to why those already existing posts couldn't/didn't help me.
I haven't received any response to my question, apart from just a "mark as duplicate" vote. My OP comes with several other concerns. Still this is marked as duplicate. Its like telling me to just keep staring at the questions they believe it to be a duplicate of, keep thinking and thinking until I somehow get the explanations(which seems very unlikely).
I too believe marking a question as duplicate is great way to keep the site clean and clutter-free.I encourage this. But there should be a proper explanation for the action, just saying "its a duplicate" doesn't help.
EDIT 2 : END