All of a sudden, Sourcetree stopped enforcing husky git hooks to lint commit messages. Trying to commit an invalid message using the GUI behaves as if "Bypass commit hooks" is selected, but it is not.
I'm not sure if this happened because of an update to Sourcetree, I write valid commit messages from muscle memory, but over the last few weeks, I've seen invalid commits getting added by other developers. And, I've just now had time to look into it.
Using the command line works as expected.
git commit -m "foo: this should fail"
The above command will fail; however, typing the same commit into Sourcetree GUI succeeds.
Looking at the command history in Sourcetree, it shows that it's skipping the hook, but I don't understand why, this started happening out of the blue.
git --no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree commit -q -F /var/folders/pg/h0p352h12y12b__wd59m9zhr0000gn/T/SourceTreeTemp.PgpJDA
Can't find npx in PATH: /usr/local/git/libexec/git-core:/Applications/SourceTree.app/Contents/Resources/bin:/usr/local/git/bin:/Applications/SourceTree.app/Contents/Resources/git_local/gitflow:/Applications/SourceTree.app/Contents/Resources/git_local/git-lfs:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin
Skipping commit-msg hook
Sourcetree: Version 4.0.1 (234)
System Git: 2.23.0
Just going to answer this myself. There is apparently a bug in the popular npm package I used to install the git-hooks, husky:
So, this was not a problem with Sourcetree, sorry :/
If anyone else finds this question, simply downgrade to firstname.lastname@example.org and that seems to work.
Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events