Git pre-commit hook failing in GitHub for mac (works on command line)

前端 未结 3 603
后悔当初
后悔当初 2021-02-07 02:52

I\'ve created a very simple pre-commit script:-

#!/usr/bin/env sh

# Run tests
npm test
if [ $? -ne 0 ]; then
  echo \"Tests failed. Aborting..\"
  exit 1
fi

ex         


        
3条回答
  •  一整个雨季
    2021-02-07 03:27

    For me it was that I didn't have a dependency installed that was being called from pre-commit. In my case this was composer, so a brew install composer helped me out.

    For future peeps, check if you are missing any dependancies being called in your pre-commit file by opening your-project-directory/.git/hooks/pre-commit in your favorite text editor and install missing the dependancies as needed.

提交回复
热议问题