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:
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 ID
876543210987654321 is a base64 encoded response ID
34106 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:
SourceTree
Now has an MSI installer:
Has old steps for 2.x versions to get around the above hoopla:
–jeroen