I would like to create a message that pops up whenever someone clones a git repository using gitolite. I want to remind them to clone the hooks repo as well and to activate the contained hooks. How can I do that?
Asked
Active
Viewed 2,230 times
2 Answers
3
I realized that this feature is just not possible. It's not allowed to run any unauthorized code from the server on the client - even if it's just a printed message.

mattmilten
- 6,242
- 3
- 35
- 65
1
The post-checkout hook is also run after git clone
. Could be you could install a post-checkout hook on your gitolite-managed repos to emit a string of instruction. Whatever the hook says should get echoed to the user.
The speculation to fact quotient in the above paragraph is probably about .6 or higher, so YMMV wildly.

Dan Ray
- 21,623
- 6
- 63
- 87
-
This way, there would be a message after every checkout. People may be annoyed by that. I'm searching for a hook that is invoked only after git clone is performed. Thanks for your answer, though. – mattmilten Jul 13 '11 at 15:25
-
Well, there would be a message on every checkout from the central repo. You wouldn't want the same hook in the cloned copies. I've often included a "hooks" directory in my repo itself, and the user has to copy that into .git after cloning. – Dan Ray Jul 13 '11 at 15:27
-
I prefer it this way: Clone a special "localhooks" repo and link all hooks of your normal repos to it. Fortunately, I use just a commit-msg hook that applies for all repos. – mattmilten Jul 13 '11 at 15:36
-
Doesn't mean you have to use the same set of hooks in your central gitolite repo. That one could have the instructions and reminders. – Dan Ray Jul 13 '11 at 15:44
-
Hmm, perhaps I don't understand what you mean. Wouldn't everyone still get the message after every pull from the central repo? – mattmilten Jul 13 '11 at 15:58
-
Well, again, I'm totally speculating here. A pull isn't a checkout or a clone. It's a fetch and a merge. It seems entirely possible to me that post-checkout wouldn't happen after a pull. I think it's worth experimenting with, because if so, that's your answer. – Dan Ray Jul 13 '11 at 16:57
-
This is what I put into post-checkout: `#! /bin/bash echo "Please activate git hooks from the 'localhooks' repository before you start working." echo "Just clone 'localhooks' and run 'installhooks'."` This hook was copied to all repos by gitolite (as expected). Unfortunately, there is no message after a git clone. – mattmilten Jul 14 '11 at 09:39