Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I prevent a git push if Travis fails?

I have integrated my GitHub repo with Travis. Currently, I can run git push origin master, and then see a Travis build error a few minutes later, meaning I have a broken master build.

Is there any way I can stop git accepting the push if Travis fails to run?

I know I can just push to a git branch and then only merge it if it runs cleanly, but I was wondering if there was any way to get git itself to refuse to acccept the push.

like image 931
Richard Avatar asked May 12 '15 15:05

Richard


1 Answers

Travis only sees your code when you push to the remote github repo. So no, the only way you can do this is to use branches like they were intended in git.

The correct process is to write your new code on a branch. Push to that branch. Create a pull request in github. Then only merge to master if the Travis build passes.

like image 159
b4hand Avatar answered Oct 15 '22 00:10

b4hand