Sourcetree Custom Actions - Couldn't posix_spawn: error 8
I had to add the following to the beginning of the .sh:
#!/bin/sh
cd $1
Then in the Sourcetree Custom Action Parameters, add this parameter:
$REPO
This way the .sh script will receive $REPO (the repo path) as the $1 parameter, and cd will go to this dir before running commands.
Here's another example showing how to do it: https://gist.github.com/mike3k/6125852
This is fixed by adding an interpreter to the first line of your script:
#!/bin/bash
It appears that Sourcetree is not setting a default interpreter for the NSTask they are using to launch the script:
https://stackoverflow.com/questions/25559608/running-shell-script-with-nstask-causes-posix-spawn-error