关于无法访问github解决办法
首先ping 一下http://github.com,试试能不能ping通
1.通过站长工具找出DNS地址:进入站长工具网站的域名解析网址:http://tool.chinaz.com/dns/ ,在A类型的查询中输入http://github.com,github.global.ssl.fastly.net找出最快的IP地址;
2.修改host文件
mac 先sudo vi /etc/hosts打开。
20.205.243.166 github.com 19 104.244.43.228 github.global.ssl.fastly.net
从这个网站查看github的ip地址,然后做个host映射。
https://github.com.ipaddress.com/#ipinfo
vi /etc/hosts
添加如下代码:
# Github Hosts # update: 2021-03-21 140.82.114.3 github.com 140.82.114.10 nodeload.github.com 140.82.113.5 api.github.com 140.82.114.10 codeload.github.com 185.199.108.153 training.github.com #185.199.108.153 assets-cdn.github.com 185.199.108.153 documentcloud.github.com 185.199.108.154 help.github.com 185.199.108.153 githubstatus.com 199.232.69.194 github.global.ssl.fastly.net 199.232.96.133 raw.github.com 199.232.96.133 raw.githubusercontent.com 199.232.96.133 cloud.githubusercontent.com 199.232.96.133 gist.githubusercontent.com 199.232.96.133 marketplace-screenshots.githubusercontent.com 199.232.96.133 repository-images.githubusercontent.com 199.232.96.133 user-images.githubusercontent.com 199.232.96.133 desktop.githubusercontent.com 199.232.5.194 github.global.ssl.fastly.net 199.232.96.133 avatars.githubusercontent.com 199.232.96.133 avatars0.githubusercontent.com 199.232.96.133 avatars1.githubusercontent.com 199.232.96.133 avatars2.githubusercontent.com 199.232.96.133 avatars3.githubusercontent.com 199.232.96.133 avatars4.githubusercontent.com 199.232.96.133 avatars5.githubusercontent.com 199.232.96.133 avatars6.githubusercontent.com 199.232.96.133 avatars7.githubusercontent.com 199.232.96.133 avatars8.githubusercontent.com # End of the section
打开终端输入sudo killall -HUP mDNSResponder
gitHub push 到远程 可能会出现的443错误
解决方式:
注释上文代码
185.199.108.153 assets-cdn.github.com
新生成密钥的时候,ssh -T git@github.com的时候,或者git clone或者push的时候,经常会报这样的错误:
The authenticity of host 'github.com (192.30.255.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
这是少了一个known_hosts文件,本来密钥文件应该是三个,现在是两个id_rsa, id_rsa.pub,便报了这样的错误,此时选择yes回车之后,便可,同时生成了缺少了的known_hosts文件:
Are you sure you want to continue connecting (yes/no)? //输入yes,回车