gitolite/git: how can I automatically populate the git pre-commit/pre-push hook

150 views Asked by At

I would like to automatically populate the .git/hook/pre-push/pre-commit file with custom content whenever someone clone my repositories.

How can I achieve that ?

1

There are 1 answers

1
twalberg On

git won't do this on it's own - by design. Not sure about gitolite, as I'm not familiar with it.

One way you could accomplish this would be by distributing a custom clone script that runs git clone and then creates/copies the hook scripts into the proper location, possibly getting them from the repository itself, or from a HTTP or FTP server, or hard-coding the hook contents in the script.