GitHub 拉取远程仓库到本地错误:The authenticity of host 'github.com (13.229.188.59)' can't be established.

 

1.在 github 上创建了个人仓库 通过 git 同步到本地时发生了以下错误:

GitHub 拉取远程仓库到本地错误:The authenticity of host 'github.com (13.229.188.59)' can't be established.

原因是连接 Git 时使用的是 SSH 进行连接,因此第一次连接时需要验证 GitHub 服务器上的 Key,这时需要我们在本地生成 Key 并配置到 GitHub 服务器中。

2. 使用以下命令

2.1  ls -al ~/.ssh

GitHub 拉取远程仓库到本地错误:The authenticity of host 'github.com (13.229.188.59)' can't be established.

2.2 ssh-****** -t rsa -C "github用户名",依次按 Enter

GitHub 拉取远程仓库到本地错误:The authenticity of host 'github.com (13.229.188.59)' can't be established.

2.3 使用命令查看生成的 Key:cat ~/.ssh/id_rsa.pub

GitHub 拉取远程仓库到本地错误:The authenticity of host 'github.com (13.229.188.59)' can't be established.

3. 将上面生成的一整串信息配置到 GitHub 中(点击头像 -> Settings -> SSH and GPG keys -> New SSH key)

4. 将代码同步到 GitHub

以上就可以解决这个问题了。如果你在提交的时候又出现了这个问题:Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.

GitHub 拉取远程仓库到本地错误:The authenticity of host 'github.com (13.229.188.59)' can't be established.

记得在 hosts 中配置:

13.250.177.223 github.com // IP 需要换成自己的