I am attempting to use Sourcetree Custom Actions to run a shell script:
When I press the hotkey, I instead get the error:
hubSync.sh
Couldn't posix_spawn: error 8
Completed with errors, see above
Why is Sourcetree not running the script?
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: