且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Git错误:“主机密钥验证失败”当连接到远程存储库时

更新时间:2023-01-09 12:55:50

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 domain.com has changed. If this does not seem fishy to you, you can remove the old key from your local cache using

$ ssh-keygen -R domain.com

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.