How to add commit-msg hooks in default Gerrit hooks

1,936 views
Skip to first unread message

Dnyaneshwar Sonawane

unread,
Mar 2, 2015, 3:28:30 AM3/2/15
to repo-d...@googlegroups.com
Currently we are running scp to download hook at every new clone of Gerrit repository. I want to avoid it everytime.

How to add commit-msg hooks in default Gerrit hook.

so that we dont need to scp it explicitly.

Thanks

David Pursehouse

unread,
Mar 2, 2015, 3:32:08 AM3/2/15
to Dnyaneshwar Sonawane, repo-d...@googlegroups.com
If you add a section like this in your .gitconfig file:

[init]
templatedir = /home/username/.git_templates/

and then copy the commit-msg hook file into a hooks folder in the
.git_templates folder, the hook will be installed in every new git that
is created with git clone or git init

Dnyaneshwar Sonawane

unread,
Mar 2, 2015, 3:35:57 AM3/2/15
to repo-d...@googlegroups.com, dnyaneshwa...@globallogic.com
Thanks David for your response.

Actually i want to do this on Gerrit Server. Is it possible to add hooks in Gerrit repository when project is created from gerrit ? so that at client side you dont need to add hooks explicitly. 

Alex Blewitt

unread,
Mar 2, 2015, 4:04:13 AM3/2/15
to Dnyaneshwar Sonawane, repo-d...@googlegroups.com
No, that's not how Git works. 

Alex

Sent from my iPhat 6
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dnyaneshwar Sonawane

unread,
Mar 2, 2015, 4:37:08 AM3/2/15
to repo-d...@googlegroups.com, dnyaneshwa...@globallogic.com
Ideally there should be such way. I want to avoid scp command on every clone made by user.

I think there might be some way to achieve this, As we have hook folder into Git repo.Can we add that file over there ?

Alex Blewitt

unread,
Mar 2, 2015, 4:52:25 AM3/2/15
to Dnyaneshwar Sonawane, repo-d...@googlegroups.com
Since there isn’t, there isn’t much point in wishing that were so.

Alex

Marcelo Ávila

unread,
Mar 2, 2015, 6:57:46 AM3/2/15
to Alex Blewitt, Dnyaneshwar Sonawane, Repo and Gerrit Discussion
Reply all
Reply to author
Forward
0 new messages