Search code examples
gitterminalgit-tower

Tower (GIT) custom script?


I am new to Tower. What I am trying to do is prevent pushing the repo to our remote if a file in the repo called index.html contains a string "1234".

Any suggestion?

And, if Tower does not allow that, can it be done when using git straight from terminal?

Thank you


Solution

  • So I found a solution that works for me.

    As far as the pre-push hook goes, it actually does exist. (This is just to answer the comment VonC left).

    As of git 1.8.2 the pre-push hook can be run. So, what I am doing is exiting with a non zero value from the pre-push hook when I try to push and a certain file I specified in the pre-push hook contains a certain string.

    So I guess that does what I needed to do. I can see that doing this on the server side is better, but in this situation I needed it to work this way.

    So, by using git 1.8.2 it can be easily accomplished by using the pre-push hook.