Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my Git pre-commit hook not running in GitKraken

Tags:

git

gitkraken

I'm trying to enforce Git Flow on a Git repository. I used the following hook to try to prevent commits to the master and develop branches. Contents of .git/hooks/pre-commit:

#!/bin/bash
if test $(git rev-parse --abbrev-ref HEAD) = "master" ; then 
  echo "Cannot commit on master"
  exit 1
fi
if test $(git rev-parse --abbrev-ref HEAD) = "develop" ; then 
  echo "Cannot commit on develop"
  exit 1
fi

When I test commits to these branches in GitKraken the commits are allowed. I made the Git was on the path and that the file showed as executable.

like image 532
Theron Avatar asked Oct 21 '25 12:10

Theron


2 Answers

Update: Version 2.3 added git hook support!

After some research and trying all the suggested solutions I could find I discovered that GitKraken just doesn't support many hooks as of now. I'm just protecting the branches I want on GitHub for now so at least they can't be pushed to but if this ever changes, I'd love to know because I'd prefer to prevent the commit in the first place.

like image 178
Theron Avatar answered Oct 23 '25 01:10

Theron


As of April 3, 2017 GitKraken v2.3 now supports hooks. Here's a link with all the supported hooks : https://blog.axosoft.com/2017/04/03/gitkraken-v2-3/

like image 45
DuCorey Avatar answered Oct 23 '25 01:10

DuCorey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!