简体   繁体   中英

bundle install from a new server errors due to git ssh key

I am installing a new server via chef and coping ssh private and public keys into it.

After creating it, I am deploying the application onto it via jenkins and running bundle install , it fails due to

Host key verification failed.
fatal: The remote end hung up unexpectedly

If I ssh into the server and run the bundle install command myself, I get prompted with

The authenticity of host 'bitbucket.org (104.192.143.1)' can't be established.
RSA key fingerprint is 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40.
Are you sure you want to continue connecting (yes/no)?

same for github

The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes

I press yes, the bundle finishes. On top of that, if I now run the jenkins job again, the bundle finishes successfully.

Any ideas, how to auto approve this authenticity of those remote servers via jenkins?

The approved information is held in your ~/.ssh/known_hosts , so you can copy that together with your keys, that way you know what keys have been approved.

Alternatively you can retrieve the information using ssh-keyscan and append the result to your server's known_hosts , note however that if you do automatically you pose the risk of accepting MITM's machine (since you don't see what has been approved).

Finally you can disable host checking ssh -o StrictHostKeyChecking=no github.com , but that is equally bad to automating ssh-keyscan.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM