Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there anyway to set a custom commit hook to be a "default" hook when repositories are created?

share|improve this question
up vote 1 down vote accepted

Outside of the nine standard hooks installed into a new repository by the 'svnadmin create /path/to/repo' command (start-commit, pre/post-commit, pre/post-revprop-change, pre/post-lock, and pre/post-unlock), I know of no way to have additional hooks automatically included as a "default" hook for all newly created repositories.

I suppose you could build a wrapper shell script for creating new repositories that calls the svnadmin create command with a variable set for the repository path followed by a copying of the custom commit hook into the path/to/repo/hooks folder and use that for all new repositories.

Lastly, because you mention that this custom hook in particular is a commit hook, I should repeat the warning given by Version Control with Subversion when discussing hook scripts (emphasis mine):

While hook scripts can do almost anything, there is one dimension in which hook script authors should show restraint: do not modify a commit transaction using hook scripts. While it might be tempting to use hook scripts to automatically correct errors, shortcomings, or policy violations present in the files being committed, doing so can cause problems. Subversion keeps client-side caches of certain bits of repository data, and if you change a commit transaction in this way, those caches become indetectably stale. This inconsistency can lead to surprising and unexpected behavior. Instead of modifying the transaction, you should simply validate the transaction in the pre-commit hook and reject the commit if it does not meet the desired requirements. As a bonus, your users will learn the value of careful, compliance-minded work habits

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.