SourceTree 2.7 and OSX authentication issue

2 minutes read

So your are using SourceTree on OSX and you've run into this issue since the 2.7 update :

ssh_askpass: exec(/usr/X11R6/bin/ssh-askpass): No such file or directory

Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.

Sourcetree ssh-askpass Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

You are not alone. See this post.

Here is what to do to solve this and still be able to push without having to enter your password at each time.

This solution requires a SSH access to your host/server and the rights to edit the .ssh/authorized_keys file.

Install ssh-askpass

Using Homebrew, install ssh-askpass:

brew tap theseal/ssh-askpass
brew install ssh-askpass

Load your SSH key

Make sure that you SSH key is loaded with this command :

ssh-add -l

If not, make sure that you havec an ssh key created and use the following command to force load it :

ssh-add -K

Upload you public key to your host

To avoid having to enter your password at each push, upload your public key to your host authorized_keys.

  1. Open your local ~/.ssh/id_rsa.pub file and copy its content.
  2. On your host/server, navigate to the related authorized_keys file. On Plesk Onyx, this would be /var/www/vhosts/example.com/.ssh/authorized_keys
  3. Paste you local public key (step 1) at the end of the file. Save/upload the file (make sure yyou have right rights).

SourceTree should be working as expected.