How to fix SourceTree error ‘ssh-agent’ failed with code -1


I recently encountered a strange error when upgrading from SourceTree 1.7 to SourceTree 1.8 on Windows 8.

The error was as follows:

'ssh-agent' failed with code -1: System.NullReferenceException: Object reference not set to an instance of an object.

An error dialog like this would always pop up whenever SourceTree 1.8 started or whenever I attempt to update OpenSSH settings.


If you are seeing this error, there is a good chance are that your ‘git for Windows’ is out of date. Installing the latest ‘git for Windows” which in my case was version 2.7.1(2) resolved the error.

I downloaded it from this site:

Hope this helps.


Please enter your comment!
Please enter your name here