git首次安装遇到的问题

Warning: Permanently added 'github.com' (ED25519) to the list of known hosts. git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

第一个问题 Permanently added 'github.com' (ED25519) to the list of known hosts

在/etc/hosts里添加github的ip地址

106.75.105.214 git.coding.net
52.74.223.119 github.com
13.229.188.59 github.com
13.250.177.223 github.com

第二个问题 Permission denied (publickey). fatal: Could not read from remote repository

  1. 在github的setting的New SSH Key添加新的密钥

  1. 获取密钥
    在git Bash here执行命令:
    ssh-keygen -t rsa -C "9622156xx@qq.com" //这估计是github绑定的邮箱
    然后一路回车或恢复y;如果成功,最后会看到:

  2. 查看密钥
    cat ~/.ssh/id_rsa.pub
    打印结果如下:

然后复制下来,粘贴到github的setting的New SSH Key中,保存下来即可

posted on 2022-02-23 18:00  In-6026  阅读(484)  评论(0)    收藏  举报

导航