SourceTree publickey error


I am using publickeys and do not keep the in the standard location. git on the command line works fine with it after I add the key to the agent using ssh-add and enter my passphrase, however sourcetree still gets an error. I tried using the system git form the settings but I still get a public key error. Any suggections on how I can configure sourcetree to work with my keys?

1 answer

1 accepted

0 votes
Accepted answer

SourceTree picks up your SSH configuration from the standard location (~/.ssh), so any configuration you use on the command line should work the same way, unless it's dependent on environment variables. Environment variables that are defined in your terminal won't be visible to Mac OS X apps, so if your setup is dependent on that it will cause a problem; you could try defining them explicitly to prove that.

The ssh authentication agent (comes with openssh) is dependent on environment variables (SSH_AGENT_PID and SSH_AUTH_SOCK) but these are standard and not specific to my environment. I assume that ssh looks for those in order to communicate with the authentication agent.

My problem was solved by using the following, which may be useful to others on OSX:

Instead of adding your keys to the authentication agent with "ssh-add" use "ssh-add -K" which uses the OSX keychain. That seemed to work with SourceTree too, and it does not break the functionality on the shell.

Thanks, I hope I helped

Thanks for the info. I assume you installed openssh from some other generic source though - Mac OS X comes with a version of openssh pre-installed that automatically uses the keychain, which is why this isn't usually an issue.

No actually I am just using the one that came with OSX. I have a script that I wrote for adding my keys to the agent. I think the -K switch is an OSX specific thing.

Ah, I see. I only use a single key in the standard location (~/.ssh/id_rsa) and that's picked up by the keychain automatically. Good to know!

Suggest an answer

Log in or Sign up to answer
Community showcase

Scrum Roles Explained: the Do's and the Don'ts

Hello Community,  Today we are going to talk about the three Scrum Roles. There is the Development Team, the Scrum Master and the Product Owner. In my opinion these three are all really impo...

160 views 2 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you