I've installed Source Tree and set it up to use system Git. However, it shows that the Git is version 1.7.4.1, but if execute:
git --version
I get:
git version 1.7.7.2
Perhaps, this is because I'm using Macports' Git and not the git distributed with Mac OS.
Yeah, this happens in 1.2 because SourceTree picks the first git it finds (and can't know what your PATH is). In 1.3, which is in beta now and will be released soon, when you click 'Use System Git' SourceTree prompts you with a browse dialog so you can point it elsewhere from the one SourceTree detects if you want.
I realize this is a fairly old thread, but I can't find a more recent one and this doesn't seem to work (Sourcetree 1.6.2.2).
I'm running Mac OSX 10.8.4, which came preloaded with Git, 1.7.12.4 (Apple Git-37), located in /usr/bin. I wanted to take advantage of some new features in Git 1.8.2+, so I installed the latest version into /usr/local/git/bin and had Sourcetree use the system git at that location. I also updated ~/.MacOSX/environment.plist to prepend that to the default path (which as I understand it will allow non-terminal applications to search there first for any executables).
However, after all this some of my custom actions were not working because the git they used didn't have these new features. To test I created a simple custom action that only ran "git --version": it still returned the 1.7.12.4 Apple-supplied version. When I renamed the git exectuable in /usr/bin the action failed completely because it couldn't find a git executable.
It *seems* to me that Sourcetree is explicitly executing custom-action git related commands using executables found in /usr/bin, and not actually relying on the PATH to find the first one available. Unless I hear otherwise, I will file a bug, as this doesn't seem like it's the intended behavior when you explicitly choose the system git executable.
For now, I've found the workaround to be manually placing a symlink in /usr/bin pointing to my /usr/local/git/bin/git executable
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We actually can't control everything in your custom actions, if you're using a script which is using bash then it's likely that it's overriding the PATH it has inherited from SourceTree (e.g. in .profile). All SourceTree can do is call it within its own environment, if it changes the PATH after that, that's out of our control.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That makes sense. However, I tried my best to make sure that the location of the new git executable would be available to all Apps. I am semi-new to MacOSX, so I may have gotten something wrong.
The new git is in /usr/local/git/bin. I have prepended that to my PATH in ~/.bash_profile (via sourcing ~/.bashrc, which actually does the exporting), which I understand only affects my bash shells, not Apps. I also added it to the default PATH in ~/.MacOSX/environment.plist. To verify, I get
Barrett$ echo $PATH >>>/usr/local/git/bin:/Applications/microchip/xc32/v1.20/bin:/Applications/microchip/xc16/v1.11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin Barrett$ defaults read ~/.MacOSX/environment >>>{ >>> PATH = "/usr/local/git/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/sur/X11/bin:/opt/local/bin"; >>>}
which looks like it's setup correctly. However, when I create a Custom Action which calls "printenv" I get
PATH=/usr/bin:/bin:/usr/sbin:/sbin
Is there some other place I need to add the path in order for SourceTree to include it in the shell it creates for custom actions? You mentioned .profile in particular, which I didn't have. But, after adding it with the same PATH exports (via sourcing my .bashrc, if that makes a difference), I still see the same PATH from the SourceTree custom action shell.
Thanks,
-Barrett
PS: Is there a better place for this discussion?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Recent versions of OS X no longer respect the contents of environment.plist, sadly - you'll need to use launchd.conf instead: http://stackoverflow.com/questions/603785/environment-variables-in-mac-os-x/4567308#4567308
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, that would explain it...
Thanks a bunch for the help.
-Barrett
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Colin Goudie
In my case not. Sourcertree says System Git version 1.7.12.2 (pointed it to the xCode.app (show package content -> Content -> Developer -> usr -> libexec -> git-core ->git)).
Terminal says git version 1.7.10.2 (Apple Git-33) (git --version).
Dont know why or how.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Running 'which git' on the command line will probably show your terminal is using an older version from somewhere else.
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.
What I would personally do is point your system git in SourceTree to wherever 'which git' points on the command line, which is usually '/usr/local/git/bin/git' (this should be the default anyway).
As for editing your profile, yes if your PATH doesn't already include /usr/local/git/bin then that would do it. That's usually configured for you though when you get a command-line version of git (either from git-scm.com or by installing the command line tools from inside Xcode from Preferences > Downloads).
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.
What happens when you run which git from the commandline. Is the output the same as the git you set up in sourcetree?
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.