SourceTree SSH options on OS X
I'm trying to connect to GitHub through SourceTree on OS X using SSH. Even though I can connect fine command line, I can't seem to work with any repo through SSH in SourceTree with the error:
Permission denied (publickey).
All the help topics I have found online suggest configuring the SSH client in SourceTree. However, all of that documentation is for the Windows version. How can I access the SSH Preferences on the OS X version of SourceTree?
Solution 1:
It was hard to find this answer, but it looks like the way to do this is to just add the ssh key to your keychain in Mac OS. I found an answer here: https://wiki.hpcc.msu.edu/display/hpccdocs/Adding+a+Private+Key+to+Your+Mac+OSX+Keychain
From the link:
On Mac OSX, the native SSH client can use the built-in keychain directly. To add your private key to the keychain simply use the command:
ssh-add -K /path/of/private/key
As an example if your private key is stored at ~/.ssh and is named id_rsa, you would use the command:
ssh-add -K ~/.ssh/id_rsa
You will then be prompted for your passcode, which will be stored in your keychain. After this you should be ready for a password-less login.
After I added my SSH key, SourceTree started authenticating correctly.
1/18/2017 EDIT: Apparently OSX Sierra made it so you don't get your keys back when you login, so you'll have to do this every time you start your computer. BUT, there's a nice way to fix this from the Apple stack exchange: https://apple.stackexchange.com/questions/48502/how-can-i-permanently-add-my-ssh-private-key-to-keychain-so-it-is-automatically
Just follow the steps in the answer with "Update Jan 2017"