unable to get SSH keys working between sourcetree and github

In order to get it worked I ended up going to Tools -> Options -> SSH Client and changing it to OpenSSH. I generated and uploaded several different types of keys trying to get it work as well but I think this is what finally did it.


In my case, I needed to switch to a git or ssh based repo path rather than the https based repo path. This causes SourceTree to switch to SSH based authentication.

This setting can be found at Repository => Repository setting => Paths

Example:

Correct repo paths

[email protected]:<username>/<reponame>.git

or

ssh://[email protected]/<username>/<reponame>.git

(Note: if you are working with a repo that isn't yours, replace username with organization name)

Wrong repo path

https://github.com/<username>/<reponame>.git

HTTPS repo paths result in SourceTree trying to be extra smart and failing spectacularly. You get prompted for a username/password GUI dialog which will never work if you have 2 factor authentication enabled.