Since the “account.json” SourceTree search did not help me much, below are the steps for installing SourceTree for Windows 3.x on an air-gapped machine.
Prerequisites:
- have a recent version of Process Explorer (for instance via [WayBack] Chocolatey Gallery | Process Explorer)
- have a download of SourceTree 3.x (from for instance [WayBack] Chocolatey Gallery | Sourcetree for Windows)
- have both the target air-gapped system, and a system having internet access available
Steps:
- Run Process Explorer on the target system
- Run the SourceTreeSetup installer on the target system
- When registering, click on the “BitBucket” button on the target system
- 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/"
- 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 - Logon, and follow the steps until the URL look like this:
http://localhost:34106/?state=authenticated&code=876543210987654321
- Copy that URL over to a web-browser on the target system and execute it
- Finish the installation steps on the target system
Now a new file should be in %LocalAppData%\Atlassian\SourceTree\accounts.json
suitable for SourceTree 3.x. In the future you might be lucky enough to copy that to a target system before installing.
I was not so lucky, because my accounts.json
was SourceTree 2.x based, which the SourceTree 3.x setup modifies, but is still not happy with.
Note these number differ on each request:
123456789012345678
is a base64 encoded request ID876543210987654321
is a base64 encoded response ID34106
is a random TCP port where the installer is listening on to get the authentication information
Fiddler
Initially, I had Fiddler steps in the above, but found out I did not need those. One thing that complicated this is that Fiddler had been removed from Chocolatey for a while, so I was not sure it would stay as a product:
- [WayBack] Latest Fiddler Release Includes Official Chocolatey Package
- [WayBack] Chocolatey Gallery | Telerik Fiddler Web Debugger 5.0.20182.28034
SourceTree
Now has an MSI installer:
- [WayBack] A simple yet powerful Windows Git GUI client for Enterprises for MSI download
- [WayBack] Sourcetree Enterprise and MSI installation – Atlassian Documentation
- [WayBack] [SRCTREEWIN-6935] Include MSI installer for latest SourceTree release – Create and track feature requests for Atlassian products.
Has old steps for 2.x versions to get around the above hoopla:
- [WayBack] How to install SourceTree through proxy
- [WayBack] Sourcetree Installation – Atlassian Login Stuck – Stack Overflow
- [WayBack] [SRCTREEWIN-7244] Can’t install SourceTree – Create and track feature requests for Atlassian products.
- [WayBack] SourceTree 2.4.8 Offline Installation
- [WayBack] SourceTree 免登录跳过初始设置 – 转
–jeroen