Friday, May 6, 2016

How to install and configure SourceTree on Windows 10

SourceTree is an amazing tool to help you manage Git repositories.

If you are still running git by hand, you are insane.  Either that, or you haven't taken the time to try out SourceTree.

Since I code on both Windows and Unix, I need some special settings that make sure that git doesen't corrupt my files and start adding \r characters all over the place.

Seriously Windows, why do you still use the \r character?  It boggles the mind.

1) Install to C:\tools\SourceTree


You can choose any directory you want but I like shorter paths that don't have spaces in them for easier MinGW/MSYS compatibility.

1.A) Connect your Github account


During the installation process there is an option to connect your Github account, which you probably want to do.

1.B) DO NOT configure automatic line ending handling.


Make sure you UNCHECK "Configure automatic line ending handling by default (recommended)."

They should reword that as "automatically butcher all whitespace in your Mac/Linux source files" which is a much more accurate description of that that option does.


2) Configure SourceTree


Now start up SourceTree and let's configure it the way we want.

I've noted the main settings that I like to change, but you should look at all of the options and see if there is anything else you want to change while we're at it.

Tools -> Options -> General



  • Set up your Default user information
  • Make sure SSH Client is set as "PuTTY / Plink"
  • Set Misc / Project folder to your preference
    • Mine is "C:\Users\ross\git" which is the same as ~/git in MinGW/MSYS

Tools -> Options -> Git


  • Global Ignore List
    • Change this to be the gitignore_global.txt in your home directory
      • Example mine is "C:\Users\ross\.gitignore_global"
    • This way it will use the same file as your command-line git in MinGW/MSYS uses

3) DISABLE ANTI-VIRUS IN YOUR SOURCE DIRECTORIES


Make SURE you disable Anti-Virus in your source directories!

I added an exception in my Norton AV so it will NOT scan "C:\Users\ross\git" which is where I keep my source.

You should add an exception for every one of your source directories.

If you forget to do this, then every time you switch branches in git, your machine will grind to a halt.

Your AV sees that 1000s of files have changed, and it scans them all!  It literally makes branching and merging a nightmare.

So just disable AV in your source directories and save yourself some headache.

Updates


15-May-16 - Fixed path to .gitignore_global such that it matches the msys file.

1 comment:

  1. It’s hard to find knowledgeable people on this subject, however you sound like you recognize what you’re talking about! Thanks gsn casino slots

    ReplyDelete