SSH clone Bitbucket DC Sourcetree fails Error: : Unable to open connection: Host does not exist fata
Asked by GSHerber:

**Attempting to clone ssh in sourcetree. Consistently get Error:**

Command: git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks ls-remote ssh://git@AZG1-DEVOPWEBD1.ad.local:7999/test/demo.git  
Output:  
Error: Unable to open connection:  
Host does not existfatal: Could not read from remote repository.

Please make sure you have the correct access rights  
and the repository exists.

**Attempt clone from git:**

C:\\Users\\gary.herber\>git clone ssh://git@AZG1-DEVOPWEBD1.ad.local:7999/test/demo.git C:\\bit9prog\\dev\\Demo  
Cloning into 'C:\\bit9prog\\dev\\Demo'...  
ssh: Could not resolve hostname azg1-devopwebd1.ad.local: Name or service not known  
fatal: Could not read from remote repository.

Please make sure you have the correct access rights  
and the repository exists.

**Attempt clone from git with IP:**

C:\\Users\\gary.herber\>git clone ssh://git@10.242.128.175:7999/test/demo.git C:\\bit9prog\\dev\\Demo  
Cloning into 'C:\\bit9prog\\dev\\Demo'...  
The authenticity of host '\[10.242.128.175\]:7999 (\[10.242.128.175\]:7999)' can't be established.  
RSA key fingerprint is SHA256:8quDqTYdesSq4R8u1UGgAcLfYO4mHhgR2d8RTee3iYo.  
This host key is known by the following other names/addresses:  
\~/.ssh/known_hosts:1: \[azg1-devopwebd1\]:7999  
\~/.ssh/known_hosts:2: \[azg1-devopsbtp1.ad.local\]:7999  
Are you sure you want to continue connecting (yes/no/\[fingerprint\])? yes  
Warning: Permanently added '\[10.242.128.175\]:7999' (RSA) to the list of known hosts.  
git@10.242.128.175: *Permission denied (publickey)* .  
fatal: Could not read from remote repository.

Please make sure you have the correct access rights  
and the repository exists.

Can anyone suggest where to look for the publickey error?


Answers:
author: GSHerber
body: For us the answer was to use PLink to update the fingerprint cache.


author: Christian Glockner
body: Hi Gary,

The first two are definitely DNS-related, as it's clearly not able to resolve the hostname.  
The last one most likely is due to the SSH key you're trying to authenticate with not being known to Bitbucket Server. Did you add the public key to your Bitbucket Server profile?

Cheers,  
Christian  

Premier Support Engineer  
Atlassian

comments: author: GSHerber
body: Christian, We've pretty much determined that the DNS isn't the source of our error, although I also thought so at first. What we have that remains is the third error *Permission denied (publickey).*Still getting that error when attempting a clone. I wonder if Bitbucket is having a problem reading the public key on the Bitbucket server. And yes the public key is added to my profile in Bitbucket.


author: GSHerber
body: Research has revealed that the '*Permission denied (publickey)* .' error is being caused in sourcetree by the Putty fingerprint cache not being updated for the public key. We have found two ways to update the cache; one using Putty and the other using Plink. Once this is done for each server the clones succeed. We are now working on configuring git command line to use the Putty cache to get them working.


Tags: bitbucket-server

server