I want to set up a custom action to run a particular git command.
I've tried putting "git" in the "script target", which errors with no explanation. I've tried putting "cmd" in the script target with "/C git" in the "Parameters" and gotten a "'git' is not recognized" error.
I use SourceTree's embedded Git on Windows (8.1). I'm sure there's a simple way to do this, but I can't find any good resources.
Hi Seth,
Custom actions can run arbitrary scripts as well as git commands. Since you're using the embedded git executable, it would probably be best if you put that command into a .bat file and use that .bat file as your script target.
The embedded Git isn't registered on my Windows %Path%, so I'm not sure I can run it from a batch file either without knowing what the path to the executable is.
It looks like the embedded Git is run inside mingw, so it may not even be possible to run via "cmd".
In other words, I know it can run arbitrary scripts and how to do that. I can't figure out the more obvious usage, which would be custom git commands.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can add git to your path or specify the path to git.exe in your .bat file.
You should be able to find git.exe here:
%USERPROFILE%\AppData\Local\Atlassian\SourceTree\git_local\bin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome! I'm glad you got that working
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's the path I needed. It also works to specify that full path to cmd \C.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For anyone interested, I created a custom action to set the executable bit (for scripts stored in Git). In windows I set the script target as "cmd" and the parameters as "/C %USERPROFILE%\AppData\Local\Atlassian\SourceTree\git_local\bin\git.exe update-index --chmod=+x $FILE" (omit the quotes).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It would be nice if sourtree would add the correct git-path itself (based on its internal/external selection) in its own process before executing custom actions. That way its much easier to giy in custom actions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I added an example of how to setup "git clean" using custom actions in Sourcetree
http://githubtraining.com/custom-actions-in-sourcetree-example-setup/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.