当前位置:   article > 正文

重装系统后,git无法拉取远程仓库更新_this key is not known by any other names

this key is not known by any other names

1、重新安装Git工具

可以参考个该链接重新下载安装:

Windows系统Git安装教程(详解Git安装过程)

2、重新配置

用 git config 配置 Git:

  1. $ git config --global user.name "John Doe"
  2. $ git config --global user.email johndoe@example.com

3、尝试拉取

报错:

  1. $ git pull origin master:master
  2. The authenticity of host 'gitee.com (212.64.62.183)' can't be established.
  3. ED25519 key fingerprint is SHA256:+ULzij2u99B9eWYFTw1Q4ErYG/aepHLbu96PAUCoV88.
  4. This key is not known by any other names
  5. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
  6. Warning: Permanently added 'gitee.com' (ED25519) to the list of known hosts.
  7. git@gitee.com: Permission denied (publickey).
  8. fatal: Could not read from remote repository.

这样就需要重新生成公钥然后添加到你的git远程服务账号下:

1)生成新的公钥

ssh-keygen -t rsa -C “johndoe@example.com”(执行后一直回车就可以了)

2)查看你生成的公钥

  1. 三种方式查看,打开你的git bash 窗口:
  2. 1)
  3.   a.进入.ssh目录:cd ~/.ssh
  4.   b.找到id_rsa.pub文件:ls
  5.   c.查看公钥:cat id_rsa.pub 或者vim id_rsa.pub
  6. 2)cat ~/.ssh/id_rsa.pub
  7. 3)也可以直接打开C盘你用户目录(一般都是Administrator)下的.ssh文件夹,打开它里面的id_rsa.pub 文件。

3) 将新生成的公钥添加到你的远程Git服务账号下(Github或者Gitee吧)

4)添加完成之后,再在本地Git Bash上验证一下 

终端输入验证:

ssh -T git@gitee.com

如图结果表示添加操作成功。 

 

 最后在试试拉取一下代码是不是就成功了。

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
  

闽ICP备14008679号