之前一直在Linux下可以訪問GitHub蛾坯,但是今天在window上發(fā)現(xiàn)連接不到GitHub了,所以在網(wǎng)上找了很多解決方法桶蛔,但都失敗了蛋辈。
以下僅是我個人試過后失敗的方法:
通過單純的在該網(wǎng)站(https://www.ipaddress.com/)查詢GitHub.com和github.global.ssl.fastly.net的IP地址后將其附加到hosts文件中
經(jīng)過測試后只可以ping通,但不能成功打開GitHub網(wǎng)站
測試成功的方法:
于是之后我又在一位博主那找到了新的方法航唆,同時也大致了解了是什么原因?qū)е碌臒o法登錄GitHub胀蛮,之后會附上博主的地址有興趣的可以去了解一下。
以下是我在該博主那得到的方式:
以記事本打開C:\Windows\System32\drivers\etc\hosts
在最下方增加新的host地址:
#GitHub Start
140.82.114.4 github.com
140.82.113.4 gist.github.com
185.199.108.153 assets-cdn.github.com
199.232.96.133 raw.githubusercontent.com
199.232.96.133 gist.githubusercontent.com
199.232.96.133 cloud.githubusercontent.com
199.232.96.133 camo.githubusercontent.com
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
#GitHub End
如圖:
由于host地址可能會有失效的情況糯钙,所以以該博主的最新更新為主粪狼。
附上博主大大的地址:「GitHub」訪問失敗,解決方案<2021/1/28> “頭像 HOST 加載成功”
同時該博客中有關(guān)于hosts文件由于權(quán)限不夠?qū)е聼o法修改的解決方法任岸,但個人覺得有
些麻煩再榄,附上一種比較簡單的方法供參考:win10下以管理員身份打開hosts文件