报错为:
ssh: connect to host github.com port 22: Connection refused
fatal: 无法读取远程仓库。
方法:hosts文件里修改github.com的ip,可以在dnschecker.org/ 里面查到
打开host文件:
sudo gedit /etc/hosts
最后添加20.205.243.166 github.com(ip不一定是这个)
保存,终端刷新缓存
sudo systemd-resolve --flush-caches
继续git clone,报错为
The authenticity of host 'github.com (20.205.243.166)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,20.205.243.166' (ECDSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: 无法读取远程仓库。
方法:将ssh密钥添加到github仓库