gitsshatlassian-sourcetreegit-clonepageant

SSH Authentication Failed when trying to clone a git repo in SourceTree


I am trying to clone a git repo that is currently configured using SSH public/private keys rather than passwords. I can SSH into this using PuTTy and have used the following command to generate the keys (its a Unix based server).

$ ssh-keygen -t rsa "john@mysite.com"

This generates as you would expect the two files within my .ssh/ directory.

The issue I am having is basically trying to clone this same git repo to my local Windows desktop through a common git client like SourceTree.

When I try to check out via SourceTree it says the following :-

SSH Authentication Failed
Your SSH agent (Pageant) is running but the server still rejected your connection...

I have Pagent installed but unsure what to do from here? Any ideas...

-- update -- When I open the private key on the remote server this is the structure (obviously longer & i've changed it for security purposes...)

-----BEGIN RSA PRIVATE KEY-----
MIIEoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-----END RSA PRIVATE KEY-----

Solution

  • Change your ssh client to openssh. After that you need to create a new pair of key and add it to repository host machine.

    You can create the ssh key using

    ssh-keygen -t rsa -b 4096 -C "your_email@domain.com"