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.

5
  • possible duplicate of git hooks : is there a clone hook? Commented May 22, 2015 at 15:37
  • jubobs, i want the commit-msg hook to be copied in a transparent manner, without additional parameters to 'git clone'. Commented May 22, 2015 at 16:14
  • Then, the answer is that it's not possible; no with Git alone. Commented May 22, 2015 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? Commented May 22, 2015 at 16:15
  • So.. I will try an alternative solution! Thank you Jubobs and jthill! Commented May 22, 2015 at 16:27

1 Answer 1

0

try this

 $ git clone server:/path && scp -p -P portnumber userlogin@serverip:commit-msg-path cloning_project/.git/hooks/ 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.