I'm using SourceTree 184.108.40.206 on OSX 10.8.4 and as part of my companies commit process we've created a commit-msg hook, in ruby, that is designed to prevent a user from commiting code unless their commit message conforms to a specific set of rules.
Unfortunitly, it seems that SourceTree makes use of the ruby v1.8.7 that Apple distributes with OSX in 'System/Library/Frameworks/Ruby.framework/Versions/current/usr/bin' instead of using '/usr/bin/env ruby'. This causes all kinds of havoc especially since some of the gems we want to use depend on ruby 1.9+.
Is there anyway to switch the ruby which SourceTree utilizes to run git hooks? or is this something that Atlassian has to change in SourceTree? if so would you please.
Thanks - AYAL
We'd use whatever's available on the $PATH, but this is a per-instance concept. Just because the PATH was set somewhere else doesn't mean it's available in the current execution. Steve's comments from another thread better explain it than I can:
It's not something we can fix ourselves, it's an effect of the fact that terminals and full .apps have compeletely different environments (and PATH variables), so just adding something to your PATH in the terminal isn't going to make it visible to something launched by SourceTree. The way to resolve it is to add this folder to your global PATH for .apps too, which you do by editing /etc/paths or adding a new entry to /etc/paths.d
So you'd need to add /usr/bin/env to your global PATH making sure it takes precedence so it's the first ruby version that's called when running your hook.
Hope that helps, feel free to ask more questions if you need more help.
Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs