Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

using proxies with SourceTree

andrewbutterfield October 6, 2011

How do I tell sourcetree where to get proxy imformation. It's not pulling it of the MAC OS X Network Preferences

10 answers

1 accepted

5 votes
Answer accepted
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 6, 2011

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

Dave Hergert
Contributor
May 1, 2013

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:password@proxy.example.com:80
I then sometimes get an SSL error which can be remediated by following the solutions mentioned here: http://stackoverflow.com/questions/3777075/ssl-certificate-rejected-trying-to-access-github-over-https-behind-firewall/4454754#4454754

daniel_gutierrez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 29, 2017

Gracias. De 10 !

5 votes
rickkasten
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 4, 2017

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.

2 votes
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 6, 2011

Yeah, I'll investigate whether it's possible to extract this information and insert it for you in the git / hg configurations in future. This is actually the first time it's come up.

Bill_Torpey
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 8, 2018

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 vote
Brandon S. Lee
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 5, 2017

For my mac behind the proxy server, it works.

 

  1. Open the mac terminal.
  2. Edit the bash_profile
    1. $ vi ~/.bash_profile
  3. Put the lines below. If your proxy server uses PAC file, then you can find the proxy server url once you download the PAC file and open it.
    1. export http_proxy=http://1.1.1.1:8080
    2. export https_proxy=https://1.1.1.1:8080
  4. $ source ~/.bash_profile
  5. Run it from the terminal.
    1. $ /Applications/SourceTree.app/Contents/MacOS/SourceTree

 

Hope it works for you.

Gabriele Ricci
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 22, 2020

> If your proxy server uses PAC file, then you can find the proxy server url

This worked like a charm

1 vote
linacreative
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 22, 2013

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.

1 vote
Paul Waldo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 6, 2013

+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!

0 votes
William Brett-Atkin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 20, 2017

Hi there, 

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:

[http]
  proxy = hostname:port
Obviously I change the host name and port to the correct hostname and port but I then get this error in sourcetree:
"

fatal: bad config line 1 in file /usr/local/git/etc/gitconfig

"
[http] is line 1. I've also tried putting the code at the end of git config but same error different line error.

Any ideas?

erolando
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 28, 2017

[http]  

proxy = hostname:port

 

works for me, in mac os sierra

 

thanks

0 votes
Michael Parks November 12, 2013

+1 for this request - If I'm using git at the command line, there's a 99% chance that I need different proxy settings than if I'm using Sourcetree (since that's almost always used with Github for me).

0 votes
andrewbutterfield October 6, 2011

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 !

0 votes
andrewbutterfield October 6, 2011

Duh! Explring around the SourceTree GUI I found something that opened up thre .hgrc file for editing. Distant memories lead to mercurials .hgrc documentation

http://www.selenic.com/mercurial/hgrc.5.html

where I discovered the notion of a http_proxy section - adding in the lines below sorted out my problem.

[http_proxy]

host = myproxy.whatever.com:8080

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events