2

I am attempting to use Sourcetree Custom Actions to run a shell script:

SourceTree Custom Actions

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?

3 Answers 3

3

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

2

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

0

For me it was changing the interpreter to zsh like so:

#!/bin/zsh

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .