git – Server host key not cached – Windows twist

I’m having a problem similar to the one in git – Server host key not cached, but there is a twist that is making the best solution there not work.

The twist is that I am trying to clone a repository from Stash, an application from Atlassian like git-hub that our company uses for storing its git repositories. After I enter my public key into Stash, I use Git Bash to try to clone a repository from there with the ssh address provided me by the system. This is what results:

$ git clone ssh://
Cloning into 'gitrepo'...
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:12
Connection abandoned.
fatal: Could not read from remote repository.

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

Since I’m not using putty to try to connect, I tried the solution of connecting to the server with ssh:

$ ssh ssh://
ssh: no address associated with name

If I tried shortening down the address that ssh can recognize, I get a different fingerprint than what git is rejecting:

$ ssh ssh://
The authenticity of host ' (10.XX.XXX.XX)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:34.
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.

I choose not to continue connecting because if I do connect, it just puts an entry that does not help git to do its job into my known_hosts file.

Anyone know how to get around this problem?

  • Cannot clone from GitLab in Android Studio via SSH
  • How is the Github handling so many public keys
  • Ading users to Gitolite
  • Cannot push to github, ssh: Could not resolve hostname
  • How to create a repository with ssh:// access on a server
  • WordPress development workflow with version controlling
  • git not connecting over my work proxy
  • Git Bash cannot find git directory when git is installed
  • One Solution collect form web for “git – Server host key not cached – Windows twist”

    I had a colleague give me a hint that eventually got me past my problem. The answer to the immediate question I posted above was that I was not giving ssh the port number in the format it expected. You don’t specify the port number like this…


    …but rather like this:

    ssh -p 7999

    This syntax caused ssh to ask if I wanted to store the host in the list of known hosts, and it gave me the fingerprint that Stash had told me it was supposed to use. (After I said yes, ssh hung up my Git Bash prompt and I had to kill the entire Git Bash session and start a new one. But at least the host had already been stored in the known_hosts file. 🙂 )

    Once I was past that problem, the only other thing I had to do was apply a solution in this thread github: No supported authentication methods available, which was to set the GIT_SSH variable in my .bash_profile for the Git Bash

    export GIT_SSH=/bin/ssh.exe

    After I had done that and restarted Git Bash, git started working using my ssh key.

    Git Baby is a git and github fan, let's start git clone.