Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git hook automatic installation

Tags:

git

githooks

I am working in big project with many repositories with many branches and people who works with them. We have commit message standard but people are people and sometimes make this commit massages incorrect. That's why i create a git commit hook and now i need some how to install it on all users local repositories.

So the question is it possible to install this commit hook automatically not to ask users about it?

like image 705
user6329667 Avatar asked Oct 20 '16 13:10

user6329667


1 Answers

So the question is it possible to install this commit hook automatically not to ask users about it?

It's not. Being able to automatically install scripts on a machine that will run without any intervention from the user is a substantial security issue, which is why there is no facility to do this.

There are a few things you can do:

  • Provide a script in the repository that will configure your git hooks, and provide instructions to run the script after cloning the repository.

  • Implement enforcement policies on your git server, so that if someone tries to push a change that doesn't meet your standards it will be rejected. This will encourage people to install your local hooks.

like image 88
larsks Avatar answered Oct 27 '22 20:10

larsks