1

I created a commit-msg hook in my remote repositories, but i have to manually copy it to local .git/hooks/ directory after clone the projects.

Is there any way to copy this hook to local repo at the moment of cloning? Or any way to automate this task?

I want the hook to be copied without any intervention from the programmer, only with:

$ git clone server:/path

Thank you.

Erick Andrade
  • 11
  • 1
  • 4
  • possible duplicate of [git hooks : is there a clone hook?](http://stackoverflow.com/questions/10228065/git-hooks-is-there-a-clone-hook) – jub0bs May 22 '15 at 15:37
  • jubobs, i want the commit-msg hook to be copied in a transparent manner, without additional parameters to 'git clone'. – Erick Andrade May 22 '15 at 16:14
  • Then, the answer is that it's not possible; no with Git alone. – jub0bs May 22 '15 at 16:15
  • 1
    The specific question isn't identical, but the underlying question is: [is there a way to inject code into other people's repos](http://stackoverflow.com/questions/26786778/can-i-specify-git-config-values-in-a-repo/26787439#26787439)? – jthill May 22 '15 at 16:15
  • So.. I will try an alternative solution! Thank you Jubobs and jthill! – Erick Andrade May 22 '15 at 16:27

1 Answers1

0

try this

 $ git clone server:/path && scp -p -P portnumber userlogin@serverip:commit-msg-path cloning_project/.git/hooks/
mahinlma
  • 1,208
  • 3
  • 11
  • 24