How to install SourceTree through proxy
Asked by Lassi Autio:

I should intall SourceTree to server that has connection to Internet only through proxy. What should I do to install it through proxy?

I found exacty same question but it doesn't have an unswer:

<https://community.atlassian.com/t5/Sourcetree-questions/How-to-install-Source-Tree-in-a-server-with-Proxy/qaq-p/630734>


Answers:
author: Peter Wake
body: I first saw this solution on another site, but posting the link seemed to get my post silently removed, so I've left it out this time. I can't take credit for coming up with this answer, though I have rewritten it, hopefully to make it simpler and clearer.

Step-by-step guide {#toc-hId-1787854812}
----------------------------------------

* Make an *Atlassian* account if you don't have one.
* Download latest installer.
* Run the installer. Progress through the steps.
* When it gets to the Atlassian login popup, quit out of the installer.
* Go to your **`%APPDATA%\..\Local\Atlassian\SourceTree`** directory.
* Create an empty text file called passwd.txt
* Create a file called **`accounts.json`**
* Paste the text below into the .json file.
* Replace the words '**YOUR EMAIL HERE**' with the email you used for the Atlassian account.
* Save your updated json file.
* Re-run the installer.
* **Magic happens!**

What should happen, is that the installer lets you skip the login step, and a working SourceTree window opens

**JSON file contents:**

```
[
 {
   "$id": "1",
   "$type": "SourceTree.Api.Host.Identity.Model.IdentityAccount, SourceTree.Api.Host.Identity",

   "Authenticate": true,
   "HostInstance": {
     "$id": "2",
     "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountInstance, SourceTree.Host.AtlassianAccount",
     "Host": {
       "$id": "3",
       "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountHost, SourceTree.Host.AtlassianAccount",
       "Id": "atlassian account"
     },
     "BaseUrl": "https://id.atlassian.com/"
   },
   "Credentials": {
     "$id": "4",
     "$type": "SourceTree.Model.BasicAuthCredentials, SourceTree.Api.Account",
     "Username": "YOUR EMAIL HERE"
   },
   "IsDefault": false
 }
]
```

comments: author: Christian M?tzing
body: Worst installation user experience ever. Thank you for your guide though.


author: Tim Cornwell
body: Works as advertised. Thanks!

(Also: exposes what the accounts.json file looks like for future reference)


author: Patrick Keenan
body: You sir are a bleeping godsend.


author: Tim Cornwell
body: Well done! Also:

HELLO ATLASSIAN!!!

++**Why-oh-why do we have to do this?**++


author: john visher
body: Thanks Peter. This worked for me also. Is everyone dead at Atlassian?


author: Marian Brostean
body: Great solution!!! Bravo!!!


author: jeroenp
body: This fails to work as of SourceTree 3.  

This works:  

1. Run Process Explorer on the target system
2. Run the SourceTreeSetup installer on the target system
3. When registering, click on the "BitBucket" button on the target system
4. In Process Explorer, find out the web browser process that the setup kicks off and grab the command-line, which looks like this when running Chrome as default browser:  
   `"%LocalAppData%\Google\Chrome\Application\chrome.exe" -- "`<https://bitbucket.org/site/oauth2/authorize?response_type=code&client_id=123456789012345678&state=authenticated&redirect_uri=http://localhost:34106/>`"`
5. Copy the URL bit <https://bitbucket.org/site/oauth2/authorize?response_type=code&client_id=123456789012345678&state=authenticated&redirect_uri=http://localhost:34106/> over and paste it on a machine that has internet access
6. Logon, and follow the steps until the URL look like this: `http://localhost:34106/?state=authenticated&code=876543210987654321`
7. Copy that URL over to a web-browser on the target system and execute it
8. Finish the installation steps on the target system


author: daniel-gredler-dhl
body: This is the straw that broke the camel's back for me. I like SourceTree, but the requirement to have a BitBucket account is barely acceptable, and then to have obscure proxy / login issues crop up because of this unnecessary BitBucket marketing ploy is unacceptable. I'm moving on to something else.

comments: author: Dave Thomas
body: Same for us. We're a BitBucket data center customer and we have the same issues. When SourceTree was developed by an independent company, it would just install with no problems. Any networking issues could be handled in the settings afterwards. With Atlassian's ownership, they've inserted this login registration step that frequently just doesn't work. If the user can log into our BitBucket server using their browser, but can't get the SourceTree installation to accept the exact same URL and login credentials, what am I supposed to tell the user? Exactly: use something else. That's what I'm telling all of our users now.


author: Bob Beauchaine
body: Ok, SourceTree is now dead to me since it cannot install in what is a common enterprise situation. I'll stick with TortoiseGit for the time being as it actually installs and doesn't require an account with a repository service I don't intend to use.


author: Millis Jonny
body: Thank you very much for the detailed guide that was described above. But unfortunately, I have other problems now. When I go to different sites, they block me as soon as I try to log in there. I have already tried all the free proxies that were possible. I also think about how I can get rid of the reduced Internet traffic. Maybe the point is that I should try using a paid proxy server? I just watched different guides on YouTube on how to fix various problems with the network. I came across the site [proxies.com](https://www.proxies.com/about) , where you can buy high-quality proxy servers. Here I think, whether it is worth trying.


author: user
body: <https://github.com/yike8/sourcetree-skip-bitbucket-registration> worked for me with SourceTree 3.3.6. Spent over an hour trying several old methods to no avail. Ugh.

comments: author: Anh Duong
body: Work for me, thanks!


author: rmjcsltd
body: It's 2020 now and I've just wasted half a day trying to install Sourcetree. Time to find a new Git GUI.

comments: author: john visher
body: Please make this easier. I've installed but other competent programers have wanted to install and use it but are unable to.


author: Prakash Rai
body: ,


author: Peter Wake
body: I found the answer to this on StackOverflow, question 36467893: [here](https://stackoverflow.com/questions/36467893/sourcetree-installation-atlassian-login-stuck/46669458?noredirect=1#comment82510007_46669458)

But this is what it amounts to...

Step-by-step guide {#toc-hId-1787849054}
----------------------------------------

* Make an *Atlassian* account at [https://id.atlassian.com](https://id.atlassian.com/signup?application=mac&continue=https://my.atlassian.com)
* Download latest installer from <https://www.sourcetreeapp.com/>.
* Run the installer. Progress through the steps.
* When it gets to the Atlassian login popup, quit out of the installer.
* Go to your **`%APPDATA%\..\Local\Atlassian\SourceTree`** directory.
* Create an empty text file called passwd.txt
* Create a file called **`accounts.json`**
* Paste the following into the .json file:

Contents of accounts.json

```
[
 {
   "$id": "1",
   "$type": "SourceTree.Api.Host.Identity.Model.IdentityAccount, SourceTree.Api.Host.Identity",   "Authenticate": true,
   "HostInstance": {
     "$id": "2",
     "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountInstance, SourceTree.Host.AtlassianAccount",
     "Host": {
       "$id": "3",
       "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountHost, SourceTree.Host.AtlassianAccount",
       "Id": "atlassian account"
     },
     "BaseUrl": "https://id.atlassian.com/"
   },
   "Credentials": {
     "$id": "4",
     "$type": "SourceTree.Model.BasicAuthCredentials, SourceTree.Api.Account",
     "Username": "YOUR EMAIL HERE"
   },
   "IsDefault": false
 }
]
```

* Replace the words '**YOUR EMAIL HERE**' with the email you used for the Atlassian account.
* Save your updated json file.
* Re-run the installer.
* **Magic happens!**

What should happen, is that the installer lets you skip the login step, and a working SourceTree window opens.

comments: author: Prakash Rai
body: Did not work for me . I am installing sourcetree 3.1.3.


author: somethingblue
body: Hi Lassi,

I found a Communities discussion that may help titled [Solved: using proxies with SourceTree](https://community.atlassian.com/t5/Sourcetree-questions/using-proxies-with-SourceTree/qaq-p/356325). The guidance is this needs to be set in the configuration for git/mercurial, etc:
> 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.

Another user mentioned using an authenticated proxy:
> ...if your proxy requires authentication (get a HTTP 407 error) you will need to put username and password in your proxy string.

I then sometimes get an SSL error which can be remediated by following the solutions mentioned here: [SSL certificate rejected trying to access GitHub over HTTPS behind firewall](http://stackoverflow.com/questions/3777075/ssl-certificate-rejected-trying-to-access-github-over-https-behind-firewall/4454754#4454754)

Cheers,

Branden

comments: author: Lassi Autio
body: Unfortunately this didn't work :(

I am installing SourceTree. How is installing using .gitconfig? Especially when it is trying to connect to Internet when asking for Atlassian account.


author: Peter Wake
body: Exactly! The answers above, and the communities answer aren't pertinent to the actual question - they address how to use git, and set git configuration - that it is SourceTree calling git is incidental, it's all a git issue.

**The actual question is about how to *install* SourceTree.** You cannot install it behind a strict proxy, because you must log in to Atlassian, and you cannot log in because the proxy is blocking that.

Configuring your git proxy won't help you there. I know because I have SourceTree 1.7 working through a proxy. I have git working through a proxy, but I still cannot install SourceTree 2.4.7.0, due to the requirement to log in to Atlassian (nor could I install 1.8 for that matter).

**What I need to know is how to configure the proxy for the *installer*. Not for git.**


author: Peter Wake
body: I posted an actual answer to this problem. But is was silently removed. I'll try posting it again, without the link, or mention of the site name, and see if it survives.


author: Nic Brough -Adaptavist-
body: Yes, I think the spam filter got it, it often does with links. I'm not sure I disagree - a lot of work I get has been generated by "I did this thing I found on stack overflow and now my Atlassian stuff is broken"


Tags: install