Hi, I downloaded SourceTree 2.7.6 today, and encountered below error, so I am denied access to all remote git operations with sourcetree.
git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree fetch origin
firstname.lastname@example.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
FYI, my github account is added in SourceTree with Oauth, my ssh keys are well setted in local directory and in github account, and I can do all remote git operation in terminal using commands.
Please help me with this issue, Thank you!
problem solved after adding the key to ssh agent using below command
$ ssh-add -K ~/.ssh/id_rsa
after some experiment I think the private key must be named id_rsa for SourceTree to work, which is an inconvenience and should be solved by sourcetree developers!!!!!!!
What you need to do is set it in the config file in your .ssh folder to use the right key when talking to the right domain. 'config' is just a plain text file that the SSH Agent uses to know which keys to use where.
In the case of GitHub you should have something that looks like this:
IdentityFile /<path>/<to>/.ssh/<YOUR KEY TO USE>
You can then set different keys to use with different domains and servers.
The other thing that is critical is to make sure you add the key you create to the Agent's list of keys like you did in your edit.
Sourcetree will respect whatever keys are loaded in your user environment and the configuration file contents, it isn't doing anything special beyond that. The SSH key management we introduced will generate and configure SSH keys for each service + account and use that if configured, otherwise it will default to id_rsa. Unfortunately macOS has a habit of forgetting loaded SSH keys which is a quirk introduced in 10.12.
Senior Mac Developer, Sourcetree