Because proxy handling is different for each of Mercurial and Git, this needs to be configured in their respective config files; this isn't currently homogenised in the SourceTree preferences. Neither Mercurial or Git picks this up from the Mac settings unfortunately.
Mercurial: edit ~/.hgrc as shown here: http://www.selenic.com/mercurial/hgrc.5.html#http-proxy
Git: edit ~/.gitconfig, add an entry like this:
[http] proxy = hostname:port
This worked for me but if your proxy requires authentication (get a HTTP 407 error) you will need to put username and password in your proxy string. Not the greatest idea in the world, but it works.
[http] proxy = username:email@example.com:80
It is completely unacceptable that this feature is not available after being open for >5 years! This is literally the ONLY dev-related application that I use that does not have proxy features built in. And because it does not, I have to manually configure each of dozens of individual repos with http.proxy settings in the local gitconfig. If I did not have that process already automated, using SourceTree would be a non-starter.
Well, it's ~ 7 years later and still SourceTree doesn't get system proxy info on Mac. This is a major PITA -- I have a MacBook that travels with me, when in the office I need to use a proxy, otherwise not.
I change my location and everything sorts itself out, except for a few apps (like SourceTree).
Pretty please ...
+1 for pulling the proxy info from the system. I travel to different locations and sometime use a proxy and sometimes don't. The proxy is set up based on the network configuration type, and it would be nice to have it set automatically, rather than having to configure a file each time I change location. I'm running OSX. Thanks!
For those who would like their Git / SourceTree proxy to change automatically, depending on their location, my workaround is to add this into my .profile (which, incidentally, is symlinked into my Dropbox for syncing across all of my machines):
# proxy probe if nc -zG 1 10.10.10.1 3128 >/dev/null; then export http_proxy=http://10.10.10.1:3128 git config --global http.proxy $http_proxy elif nc -zG 1 192.168.1.112 3128 >/dev/null; then export http_proxy=http://192.168.1.112:3128 git config --global http.proxy $http_proxy else export http_proxy= git config --global --unset http.proxy fi export https_proxy=$http_proxy export all_proxy=$http_proxy
This adjusts environment variables for the current terminal session, and Git's global config for SourceTree. As long as you open a new terminal session sometime before doing any remote work with SourceTree, you're golden.
For my mac behind the proxy server, it works.
Hope it works for you.
Duh! Explring around the SourceTree GUI I found something that opened up thre .hgrc file for editing. Distant memories lead to mercurials .hgrc documentation
where I discovered the notion of a http_proxy section - adding in the lines below sorted out my problem.
host = myproxy.whatever.com:8080
It does annoy me that so many UNIX -> Mac applications won't get proxy data from the standard place.
I will have to edit the .hgrcs manually for all my repos to get them to work with SourceTree - a really useful feature
woyld be some way of setting a system-wide proxy - its always the same for my machine no matter where the repo actually lives !
I know this is an old thread but im stuck on this exact issue. Im trying to access Bitbucket through sourcetree but we have a proxy at work.
I've tried editing the gitconfig file by adding:
fatal: bad config line 1 in file /usr/local/git/etc/gitconfig
Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events