SourceTree Installation on Windows

(Last Updated On: )

This post is how to install/Configure SourceTree.

Step 1

Install SourceTree.

Step 2

Install Beyond Compare.

Step 3

Install Git

Step 4

Create or Import your SSH key by going to SourceTree and clicking Tools then click “Create or import SSH Keys”. Follow the instructions then click “Save public key” and “Save private key” next to “Save the generated key”. Save public key to C:\Users\<USER>\.ssh\id_rsa.pub. Save private key to C:\Users\<USER>\.ssh\id_rsa.

Step 5

Update to latest SourceTree build by opening SourceTree click Tools –> Options then click “Updates” tab and update if required.

Step 6

Configure any options you want by going to Tools –> Options.

General Tab

  • Choose your theme
  • Setup SSH Client Configuration
  • Setup Default user information
  • Set your remote check for updates
  • Reopen repository tabs at startup
  • Spell check commit messages

Diff Tab

  • Convert tabs to spaces with width 4
  • External Diff tool Beyond Compare

Git Tab

  • Set Global Ignore List
  • Prune tracking branches no longer present on remote(s)
  • Push all tags to remotes
  • Fetch all tags

Authentication Tab

Setup any auth you have.

Step 7

Setup C:\Users\<USER>\.gitconfig like the below.

[core]
	autocrlf = true
[user]
	name = GaudreaultPC\\Gaudreault
	email = oliver@gaudreault.ca
[difftool "sourcetree"]
	cmd = 'C:/Program Files/Beyond Compare 5/BCompare.exe' \"$LOCAL\" \"$REMOTE\"
[mergetool "sourcetree"]
	cmd = "'' "
	trustExitCode = true
[safe]
	bareRepository = explicit

Step 8

If you are trying to transfer your SourceTree from one PC to another. The below are the steps you will need to perform.

  1. Copy your data from one PC to the other in the same exact folder structure. Include .git and .gitignore files and folders.
  2. On original PC go to %USERPROFILE%\AppData\Local\Atlassian\SourceTree and copy the following files to the new PC.
    1. bookmarks.xml
    2. opentabs.xml
  3. On the new PC close SourceTree and copy the two files from the previous step and copy to the same location as was in original PC.
  4. Ensure the new laptop has the same .gitconfig from old PC.

Step 9

Sometimes you might have issue with the repository settings for each repo. If you do just go in and fix it. Remove the origin and add back. Ensure you select “Default Remote”.