Git error: “Host Key Verification Failed” when connecting to remote repository

I am trying to connect to a remote Git repository that resides on my web server and clone it to my machine.

I am using the following format for my command:

  • Git pull without checkout?
  • Master repository and local repositories in the same machine
  • Creating local branch and rebasing it to master
  • Git Bash is unable to view all folders in Visual Studio directory
  • Eclipse can not commit all files to Git
  • Using IntelliJ IDEA for project using Makefiles
  • git clone ssh://

    This has worked fine for most of my team members. Usually after running this command Git will prompt for the user’s password, and then run the cloning. However, when running on one of my machines I get the following error:

    Host key verification failed.

    fatal: Could not read from remote

    We are not using SSH keys to connect to this repository, so I’m not sure why Git is checking for one on this particular machine.

  • Merge my fork with someone else's fork
  • Can we use :podspec link with dependencies in a podspec
  • How does git fetches commits associated to a file?
  • Git : How to reset the history of all the repositories associated with a project?
  • git filter-branch - discard the changes to a set of files in a range of commits
  • Clone some remote branches and push them to a new repository?
  • 11 Solutions collect form web for “Git error: “Host Key Verification Failed” when connecting to remote repository”

    You are connecting via the SSH protocol. Using SSH, every host has a key. Clients remember the host key associated with a particular address and refuse to connect if a host key appears to change. This prevents man in the middle attacks.

    The host key for has changed. If this does not seem fishy to you, you can remove the old key from your local cache using

    $ ssh-keygen -R

    I strongly encourage you to consider having users authenticate with keys as well. That way, ssh-agent can store key material for convenience (rather than everyone having to enter her password for each connection to the server), and passwords do not go over the network.

    As I answered previously in Cloning git repo causes error – Host key verification failed. fatal: The remote end hung up unexpectedly, add the GitHub to the list of authorized hosts:

    ssh-keyscan -t rsa >> ~/.ssh/known_hosts

    I had the similar issue, but, using SSH keys. From Tupy’s answer, above, I figured out that the issue is with known_hosts file not being present or not being present in the list of known hosts. Here are the steps I followed to resolve it –

    1. mkdir ~/.ssh
    2. vim known_hosts – if you already have known_hosts, skip this.
    3. ssh-keyscan -t rsa >> ~/.ssh/known_hosts
    4. ssh-keygen -t rsa -C ""
    5. Add the key to SSH keys list on your GitHub profile.

    I got the same problem on a newly installed system, but this was a udev problem. There was no /dev/tty node, so I had to do:

    mknod -m 666 /dev/tty c 5 0

    Its means your remote host key was changed (May be host password change),

    Your terminal suggested to execute this command as root user

    $ ssh-keygen -f "/root/.ssh/known_hosts" -R []

    You have to remove that host name from hosts list on your pc/server. Copy that suggested command and execute as a root user.

    $ sudo su                                                        // Login as a root user
    $ ssh-keygen -f "/root/.ssh/known_hosts" -R []    // Terminal suggested command execute here
    Host []:4231 found: line 16 type ECDSA
    /root/.ssh/known_hosts updated.
    Original contents retained as /root/.ssh/known_hosts.old
    $ exit                                                           // Exist from root user

    Try Again, Hope this works.

    If you are in office intranet (otherwise dangerous) which is always protected by firewalls simply have the following lines in your ~/.ssh/config

    Host *
    StrictHostKeyChecking no

    I had the similar issue, unfortunately I used the GitExtensions HMI and forgot that I wrote a passphrase.
    With HMI…. forget it ! Do not enter passphrase when you generate your key !

    You can use your “git url” in ‘https” URL format in the Jenkinsfile or wherever you want.

    git url: ''

    Ok i just forked the repo that I wanted to work with then use that…

    Here is what I wanted to do:

    npm install 'mtorromeo/vue-strap#vue2'

    I then got that error that brought me here:

    Host key verification failed.
    fatal: Could not read from remote repository.

    I then just forked that repo and now I could use:

    npm install 'emahuni/vue-strap#vue2' --save-dev

    I think the next logical step is to sync upstream:

    git remote add upstream

    so that changes from upstream are pulled locally when i do:

    git fetch upstream


    For me, I just had to type “yes” at the prompt which asks “Are you sure you want to continue connecting (yes/no)?” rather than just pressing Enter.

    According to the San Francisco State University website:

    This either means that the host has a new key and the fingerprint has changed or that you are the victim of a man-in-the-middle exploit. In order to protect you, the Mac OS X SSH client will not let you complete the connection to this host until the old key is removed from your computer. If you determine that the host’s key has been changed (see connection instructions for current keys), follow these steps to remove the old key:

    • Open Terminal in the Applications > Utility folder.
    • Type open .ssh in the terminal window then press the Return key.
    • This opens the .ssh folder which contains the file known_hosts.
      Drag known_hosts into the trash then close the .ssh folder.
      Close Terminal.
    Git Baby is a git and github fan, let's start git clone.