做技術的我們經常會訪問github.com,有時出現github訪問非常慢或者git clone速度很慢,git push也很慢
原因很簡單:github被高高的牆屏蔽了。 所以解決方案就是手動把 cdn 和IP地址綁定一下,或者更換地址。
訪問慢
1、 獲取github地址
訪問 http://github.com.ipaddress.com/ 獲取cdn域名以及ip地址
2、 獲取 global.ssl.fastly地址
http://github.global.ssl.fastly.net.ipaddress.com/ 獲取cdn域名以及ip地址
3、 獲取assets-cdn.github.com 地址(可選)
https://github.com.ipaddress.com/assets-cdn.github.com
4、修改hosts映射
Windows下用管理員身份打開以下文件
C:\Windows\System32\drivers\etc\hosts
在末尾添加上述獲取到的地址,然后保存(2020-6-6)
140.82.114.3 github.com
199.232.69.194 github.global.ssl.fastly.net
185.199.108.153 github.com
185.199.109.153 github.com
185.199.110.153 github.com
185.199.111.153 github.com
打開CMD,輸入以下命令,刷新一下DNS
ipconfig /flushdns
然后使用ping 命令試試
ping github.com
注意:如果通過此方法綁定之后,還是無法訪問,那么嘗試刪除掉host中新加的內容,關閉瀏覽器刷新DNS后再訪問試試
clone慢
在tampermonkey中安裝腳本GitHub 鏡像加速訪問、下載,然后訪問github時,頁面上會出現鏡像網站按鈕,使用鏡像網站中的地址進行clone
注意:鏡像網站中的地址只能clone,無法push
小技巧
輸入你想查詢的網址后面跟上.ipaddress.com,就可以查到域名的創建日期,服務器地址,每日訪問量等信息
比如我想查詢博客園的cnblgs.com,輸入https://cnblogs.com.ipaddress.com/,得到信息如下:
Domain Summary
Global Traffic Rank | 120 |
---|---|
Estimated Visitors | 3.1 Million / Day |
Estimated Page Impressions | 10 Million / Day |
Domain Creation Date | November 12, 2003 |
Domain Age | 16 years, 6 months and 23 days (6,050 days) |
IP Address | 101.37.97.51 |
Web Server Location | ![]() |
想查詢github.com 輸入 https://github.com.ipaddress.com/,得到信息如下:
Domain Summary
Global Traffic Rank | 74 ▾9 |
---|---|
Estimated Visitors | 4.5 Million / Day |
Estimated Page Impressions | 27.1 Million / Day |
Domain Creation Date | October 9, 2007 |
Domain Age | 12 years, 7 months and 27 days (4,623 days) |
IP Address | 140.82.114.3 |
Web Server Location | ![]() |