web-dev-qa-db-ja.com

「gitpull」できません-ホストキーの検証に失敗しました

本番サーバーへのルートアクセス権があり、最新バージョンのgitをサーバーにデプロイしたいのですが、更新するフォルダーを「gitpull」すると以下のエラーが発生します。

少しブラウジングしましたが、どうしたらよいか明確な答えが見つかりません。

ステージングサーバーは同じマシン上で実行されますが、別のフォルダー内にあり、そのフォルダーでpullすると、すべて正常に動作します。

Linuxに関してはあまり経験がないので、修正方法について明確な答えを教えてください:-)

それ以外の場合は、必要なものにアクセスできます

p.s.これは過去に機能していたので、SSHキーと関係があると思います

エラー:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The ECDSA Host key for www.site.org has changed,
and the key for the corresponding IP address x.x.x.x
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the Host
and its Host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 ECDSA key sent by the remote Host is
*************
Please contact your system administrator.
Add correct Host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:1
  remove with: ssh-keygen -f "/root/.ssh/known_hosts" -R gitlab.site.org
ECDSA Host key for gitlab.site.org has changed and you have requested strict checking.
Host key verification failed.
15
Richard

ログには、次のテキストが表示されます。

(...)
 
システム管理者に連絡してください。
/root/.ssh/known_hostsに正しいホストキーを追加して、このメッセージを削除してください。 
/root/.ssh/known_hosts:1 
の問題のあるECDSAキー削除:ssh-keygen -f "/root/.ssh/known_hosts" -R gitlab.site.org
 gitlab.site.orgのECDSAホストキーが変更され、厳密なチェックをリクエストしました。
ホストキーの検証に失敗しました。

したがって、そこで提案されているコマンドを実行する必要があります。

ssh-keygen -f "/root/.ssh/known_hosts" -R gitlab.site.org
31
fedorqui

Windows:

  1. /Users/Abhilash/.ssh/known_hostsに移動し、その中の内容を削除して保存します。

Linux/Mac:

  1. ~/.ssh/に移動します
  2. nanoknown_hosts
  3. 内部のコンテンツを削除してctrl+Oを保存します

注:もう一度押すと、キーを保存するように求められます。

16
abhiklpm

これらの手順を実行した後も、同じ問題に直面しました。

MacOSの場合:

Step 1: Go to Folder or use command+shift+g
Step 2: type "~/.ssh/"
Step 3: Open "known_hosts" file and Remove all the content
Step 4: Now Open terminal and pull from another branch, It will ask for password give your system password.

確実に動作します。

0
Purnendu roy