Git Remote Helper

I am using SourceTree on Mac. I have a remote helper set up that allows my native Git client to connect to a Mercurial repository. When I attempt to clone my Hg repo with a URL like 'hg::<url>', SourceTree reports that Git cannot find a remote helper. I have SourceTree set up to use my native Git client, and my Git client can clone from the command line.

Can you suggest how I can make this work with SourceTree?


1 answer

1 accepted

1 vote
Accepted answer

I'm guessing you've made some changes to your PATH or other environment settings in your terminal in order to make the remote helper work there. On the Mac, changes to the terminal's environment are not visible to full OS X apps, because they are launched by a service called 'launchd' and not via sh/bash where you would have made your environment changes.

You can tackle this 2 ways:

  1. Make your helper not reliant on additions to the environment, so don't rely on additions to the PATH etc, or
  2. Alter the environment that affects OS X apps too. This means editing /etc/paths or adding files to /etc/paths.d to alter PATH, or editing /etc/launchd.conf to set other environment vars (also ~/launchd.conf). See for the format.

@Steve, I've made sure that git-remote-hg is in the path (symlinked it to /usr/local/bin, which is part of /etc/paths by default) and am able to use it from the terminal by issuing:

# git fetch origin


# git remote -v
origin	hg::/path/to/origin (fetch)
origin	hg::/path/to/origin (push)

When I launch SourceTree and try to fetch from that remote in the GUI, I get:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree fetch origin 
fatal: Unable to find remote helper for 'hg'
Completed with errors, see above

Any idea why this might not be working? I didn't add the path to /etc/paths.d as it'd be redundant there and I haven't yet tried modifying launchd.conf.

I'm running system git version installed via homebrew under /usr/local.


It's important to note that SourceTree runs in its own environment entirely, and thus has its own PATH env var. If you've set up a remote helper for your repository and that helper is located on your PATH env var ('echo $PATH' on the terminal) then it won't be available from SourceTree.

This is just the way Mac apps work unfortunately.



That's what @Steve had noted in his answer, but he also gave a few suggestions on how to ensure that the helper appears in SourceTree's PATH. This is somehow not working for me, so maybe I'm misunderstanding his answer.

If I can't control what's in SourceTree's PATH, maybe I can just symlink git-remote-hg to a folder already accesible to it. What's its default PATH?


Suggest an answer

Log in or Sign up to answer
Community showcase
Published yesterday in Feedback & Announcements

How do you analyze GC logs, thread dumps and head dumps?

Hi awesome community!  In this article, I would like to describe the one of the toolset (service) for the analyze some problems on different Java-based instances, of course, as Atlassian admini...

97 views 0 7
Read article

Atlassian User Groups

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!

Find my local user group

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

Groups near you