skip to Main Content

I am trying to git clone a repository on my windows machine, with:

git clone -b <branch> ssh://<host>

I have already added the keys, and deleted the existing known_hosts file in C:Users<username>.ssh

But the git clone fails with

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the DSA key sent by the remote host is
SHA256:<fingerprint>.
Please contact your system administrator.
Add correct host key in /u/.ssh/known_hosts to get rid of this message.
Offending RSA key in /u/.ssh/known_hosts:6

Where is this known_hosts (/u/.ssh/known_hosts) file? C:Users<username>.ssh does not have this file, I was expecting for it to get created in the git clone command.

The same command works fine on my ubuntu PC.

2

Answers


  1. The mentioned path has an linux-ish look, which indicates you were probably running your command from git-bash.

    The simplest way to fix your issue is to edit the mentioned file (/u/.ssh/known_hosts) from a git-bash shell.

    Login or Signup to reply.
  2. Check your environment variable HOME: in a CMD, type set HOME.

    If it is set to U: (translated, in a bash session, to /u/), that would explain why SSH is lookig for information (keys, config file, known_hosts file, …) in U:.ssh

    Change your HOME environment variable (back to, for instance, %USERPROFILE%) to make sure SSH looks for keys where you expect it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search