question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failure during build: Host key verification failed after Initializing Git repository

See original GitHub issue

Hi there,

First of all, I’d like to thank for all the help… Also, the UI remake for Jenkins is freaking awesome… It is the best I’ve ever seen around…

Anyway, I’m trying to build using docker-compose as reported before… I still cannot get past from the git fetch due to a “Host key verification failed.”…

Started by user anonymous
Started by: null
Building remotely on 51868e9787c0 (swarm) in workspace /var/jenkins_home/worker/workspace/mdesales/isp
[isp] $ /bin/bash -le /tmp/hudson6820944739083537435.sh
$  chmod -R u+w . ; find . ! -path "./deploykey_rsa.pub" ! -path "./deploykey_rsa" -delete
$  git init
Initialized empty Git repository in /var/jenkins_home/worker/workspace/mdesales/isp/.git/
$  git remote add origin git@github.intuit.com:mdesales/isp.git
$  git fetch origin master
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Build step 'Execute shell' marked build as failure
setting commit status on Github for http://github.intuit.com/api/v3/repos/mdesales/isp/commit/49d730adb048e1697cdea994791144e0eb670ca0
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE
screen shot 2015-07-11 at 10 17 33 am

According to the http://stackoverflow.com/questions/15174194/jenkins-host-key-verification-failed/15196114#15196114, this is caused due to the lack of the ~/.ssh/known_hosts entry for the github server (on my case below github.intuit.com

What should I do in this case? I thought about copying the entry from another host to the server… (My problem is that I’m running Jenkins from a Docker Container)…

Thanks for any help!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
marcellodesalescommented, Aug 18, 2015

I tried many times to get this to work…

Attached to the worker container and created a key

[root@pppdc9prd8ok eea.docker.jenkins]# docker ps
CONTAINER ID        IMAGE                                       COMMAND                CREATED             STATUS              PORTS                                            NAMES
86a672162545        eeacms/jenkins:centos-slave                 "/bin/sh -c /bin/jen   2 minutes ago       Up 2 minutes                                                         eeadockerjenkins_centos_1
b4dffce2e68e        mongo                                       "/entrypoint.sh mong   5 weeks ago         Up 5 weeks          0.0.0.0:27017->27017/tcp                         mongodb-dotci
c0fdb5da0b68        marcellodesales/eea.docker.jenkins:master   "/usr/local/bin/jenk   5 weeks ago         Up 5 weeks          0.0.0.0:50000->50000/tcp, 0.0.0.0:80->8080/tcp   eeadockerjenkins_master_1
aaefb3453a85        yorkshirekev/postfix                        "/bin/bash -c '/star   5 weeks ago         Up 5 weeks                                                           eeadockerjenkins_postfix_1
[root@pppdc9prd8ok eea.docker.jenkins]# docker exec -ti 86a672162545 bash

Added my github enterprise to the known hosts

bash-4.2# ssh-keyscan -t rsa github.intuit.com >> ~/.ssh/known_hosts
# github.intuit.com SSH-2.0-libssh-0.6.0
bash-4.2# cat ~/.ssh/known_hosts
github.intuit.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOcJVomgrVOU371tYYVpMU+Ih9dKRp2hpvz6Dxu2nRK+nnw+BcT3ptCZFp1nTTGB5WKKYkVL5X40Y1CNQumH4HgquErAjUA5bt/+sKfaYUWSTBKHLriosshauhEKeToeOjtceT3kMeirueGlSFImlkjgG

Created an ssh key

bash-4.2# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
b7:ae:93:1f:8d:ff:b8:97:79:94:d2:c0:74:8c:c1:69 root@86a672162545
The key's randomart image is:
+--[ RSA 2048]----+
|            ..=  |
|             E o |
|            + .  |
|             o   |
|        S .   o .|
|         . + . o.|
|         .+ . .+ |
|        o. o .+ .|
|        .+o ++.. |
+-----------------+

bash-4.2# cat /var/jenkins_home/worker/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAVZw41bdAL7sA5n0M7BuEJnD9eKVeyA4lKg8X0chyjqsJ45tBOccgO77Q0QZuWSO7LDEIf1dE2ACicudJ+I88vbzWD+Wa4OhCTE2LRqGKtBv22Ei8ayxYx27X9sbfIt31k81RtmQL8TovAdDNau5q+LX4TaeJFwurc5KED2dMQ

I added the public id to my Github profile

At this point, this solved the problem of cloning. Only through the container… However, from Jenkins it still fails…

Successfully cloned the repository that’s failing

bash-4.2# git clone git@github.intuit.com:mdesales/isp.git
Cloning into 'isp'...
The authenticity of host 'github.intuit.com (10.145.0.43)' can't be established.
ECDSA key fingerprint is 69:fb:0f:96:90:64:a0:4f:58:49:fd:a5:3f:ed:d9:d4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.intuit.com,10.145.0.43' (ECDSA) to the list of known hosts.
remote: Counting objects: 147, done.
remote: Total 147 (delta 0), reused 0 (delta 0), pack-reused 147
Receiving objects: 100% (147/147), 69.96 KiB | 0 bytes/s, done.
Resolving deltas: 100% (86/86), done.
bash-4.2# ls -la

Fails in the UI

screen shot 2015-08-18 at 9 14 13 am

It fails with the error below…

$  git fetch origin master
Failed to add the RSA host key for IP address '10.145.0.43' to the list of known hosts (/var/jenkins_home/worker/.ssh/).
Permission denied (publickey).
fatal: Could not read from remote repository.
0reactions
marcellodesalescommented, Aug 18, 2015

I’m suspecting something is wrong… The compose binary that I transferred is not executing properly…

bash-4.2# chmod +x /usr/local/bin/docker-compose
bash-4.2# docker-compose
bash-4.2# docker-compose --version
bash-4.2# docker-compose
bash-4.2# docker-compose
bash-4.2# docker-compose --version
bash-4.2# docker-compose up
bash-4.2#

Question

Should the Slave image eeacms/jenkins:centos-slave or the others also include the binary of docker-compose? What’s the intended way of using it?

[root@pppdc9prd8ok eea.docker.jenkins]# docker ps
CONTAINER ID        IMAGE                                       COMMAND                CREATED             STATUS              PORTS                                            NAMES
86a672162545        eeacms/jenkins:centos-slave                 "/bin/sh -c /bin/jen   About an hour ago   Up About an hour                                                     eeadockerjenkins_centos_1
Read more comments on GitHub >

github_iconTop Results From Across the Web

Git error: "Host Key Verification Failed" when connecting to ...
As I answered previously in Cloning git repo causes error - Host key verification failed. fatal: The remote end hung up unexpectedly, add...
Read more >
How to fix the error “host key verification failed” - The Geek Diary
Method 1 – removing old key manually · 1. On the source server, the old keys are stored in the file ~/. ·...
Read more >
Host key verification failed - Accounts and Integrations
when it's trying to fetch i'm getting this error Host key verification failed . + mkdir -p raspberrypi + cd raspberrypi + repo...
Read more >
Gitlab post-receive hook Host key verification failed
When an SSH connection is initialized, the server authenticates itself to the client. The client then checks if the key is already in...
Read more >
Host Key verification failed - Red Hat Customer Portal
It seems maybe you either have a conflicting key in your known_hosts file, or you need to somehow add a relevant entry in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found