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?

Thanks,

1 answer

1 accepted

This widget could not be displayed.

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 http://www.dowdandassociates.com/content/howto-set-an-environment-variable-in-mac-os-x-slash-etc-slash-launchd-dot-conf/ 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

where

# 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 1.8.4.3 installed via homebrew under /usr/local.

@Fernando,

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.

Cheers

@Kieran,

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?

Thanks!

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

150 views 16 7
Join discussion

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