I'm trying to use a commit hook that runs eslint. To hook uses GIT_DIR
to find the package local eslint and related eslint configs. Like this:
ESLINT_PATH="${GIT_DIR}/../node_modules/.bin/eslint"
From the command line, this works fine. GIT_DIR
is set and everybody is happy. In GitKraken though, GIT_DIR
is missing. In fact, no git environment vars are set. I ran env
in the hook and looked at the output.
Is this normal behavior for GitKraken? Is there some hidden config that I'm missing?
I can mod the script, so if there's a more "proper" way to do this, I'm all ears.
I know this is a bit late to the party, but I just ran into a similar issue, and I hope this will help any future inquires.
This information is accurate for GitKraken 4.2.2, as I have not tested this with a newer version.
GitKraken does not actually use Git. It works exactly like Git, yes, but it doesn't actually require Git to be installed on your system. As per the main GitKraken download page here:
It works directly with your repositories with no dependencies—you don’t even need to have Git installed on your system. GitKraken is built with NodeGit, a Git framework that is primarily developed and maintained by members of the GitKraken development team.
As such, adding the Git hooks feature, to begin with, was (according to the GitKraken team) challenging. From the "April 3, 2017 2.3.0 Release Notes":
Git hooks! One thing that has prevented some users and teams from being able to adopt GitKraken is the lack of Git hooks support. Until today! You can now create custom scripts that fire off at certain points during Git processes. GitKraken does not require that you install Git on your system, so until now, that independence had meant no Git hooks support. But, with a lot of blood, sweat and tears, v2.3 allows you to hook your way to a bounty of control over your Git actions!
So, you won't be able to use Git environment variables since "regular" Git isn't actually being used under the hood.
In fact, a lot of the more complicated Git features won't necessarily be supported unless specifically mentioned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With