title: Git pre-commit hook failing in GitHub for mac (works on command line)
body: <p>I've created a very simple pre-commit script:-</p>
  
  <pre><code>#!/usr/bin/env sh
  
  # Run tests
  npm test
  if [ $? -ne 0 ]; then
    echo "Tests failed. Aborting.."
    exit 1
  fi
  
  exit 0
  </code></pre>
  
  <hr>
  
  <p>When I run <code>git commit</code> at the command line (with failing tests), I get the expected exit 1 with the message <code>Tests failed. Aborting..</code>.</p>
  
  <p>However, If I use GitHub for Mac however I get:</p>
  
  <pre><code>.git/hooks/pre-commit: line 5: npm: command not found
  Tests failed. Aborting..
   (256)
  </code></pre>
  
  <p>I'm guessing its down to <code>npm</code> not being available to the execution environment that GitHub for Mac is using, but I've been tearing my hair out trying to work out how to  fix this.</p>