• So I was having a lot of issues with setting up Revisr to work with my Bitbucket Server. I followed the guide for how to add an SSH key, and I added it under ~/.ssh, but still nothing worked and I kept getting the Host Key Verification Failed errors. Turns out, the key (for Apache) needed to be added to the apache user’s directory, and then the repository needed to be sync’d as apache to added it to its own Known Hosts list. Please see my steps below. (Also, if you are not able to access apache’s .ssh directory, it may be owned by root, so chown apache:apache)

    ======================

    [root@centos html]# sudo -u apache ssh-keygen -t rsa -b 4096 -C “user@example.com”
    Generating public/private rsa key pair.
    Enter file in which to save the key (/usr/share/httpd/.ssh/id_rsa):
    /usr/share/httpd/.ssh/id_rsa already exists.
    Overwrite (y/n)? y
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /usr/share/httpd/.ssh/id_rsa.
    Your public key has been saved in /usr/share/httpd/.ssh/id_rsa.pub.
    The key fingerprint is:
    fd:c2:43:01:0c:EX:AM:PL:E9:c6:f3:65:20:ca:b5:8f user@example.com
    The key’s randomart image is:
    +–[ RSA 4096]—-+
    | Removed |
    | |
    | |
    | |
    | |
    | |
    | |
    | |
    | |
    +—————–+
    [root@centos html]# cat < /usr/share/httpd/.ssh/id_rsa.pub
    ssh-rsa AAAAB3NzaC1yc2RemovedRemoveCAQCh0oXy7pGcXyzpZPrD34Sa9oNUnCWZUHutU70vYztmm4L7sF
    WNKIY59JtV21S30oVf4uuvm4dKQ9GASTw3SffdnL6Oge+6tFn+B0PdC1TXAkqhxFPc+PSa/SyfqtP/z6P4mp2l
    W6oPn67wAgT3w+dJTnmVFHcusr+CRemovedRemoveddrdOxpI1AeT+Y9fY/hBtG+pKRW6FEZs0LAfXIys+6Q1G
    /h12tKdiB1anPKPN+75Zj5nCQQ0Nm90ECb6hdiVUoxknwoSUUbV008JrglC4H9HWHUw2jJJCXlofzyrM6VgMDo
    8Bc/PZmtAiueo3D/OpRUf3fErOAKlMKNidvEOMUFbNz/jDdDtN6bfFkJEhAblxkoGP6XqQwnn9Wlkfaxl64LDG
    G1bfNflpx62euzj9EUqK3zRemovedRemovedXXXX8GF0v+iUCgWg9M73J+yDJdedRtM3FCwfFYtvzx+2zfdG0r
    /Bq70KXr+Ll4dlWBDBjYwSefM9mXW4e/YhTtipPfld7/JwD9kGu/ybPhiy2vm2yhGq7kFk0T3UgV41EhrcY5fU
    ceGhe0ftRZm9XsVykQEbLA89xEeij+ZOwf+NafxezTDOUz+j815MKRYlonZoRVtaHU7IUsiV+xmMVfXGFKGkAO
    iN3TYkRaFkYxu84mn/3T0V9rHGdVaJtBGw== user@example.com
    [root@centos html]# sudo -u apache git push origin master
    The authenticity of host ‘[www.example.com]:7999 ([xxx.xx.xx.xxx]:7999)’ can’t be established.
    RSA key fingerprint is 12:54:a5:a0:17:EX:AM:PL:Ea:a7:c6:a6:2b:9d:31:bd.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added ‘[www.example.com]:7999,[xxx.xx.xxx.xxx]:7999’ (RSA) to the list of known hosts.
    Everything up-to-date

  • The topic ‘Host Key Verification Failed Solution’ is closed to new replies.