天天看點

GitHub加速,解決通路時圖裂、加載慢、通路卡頓的問題!一、前言二、介紹三、使用方法

一、前言

如果不開科學上網,我們知道上Github的時候會很卡。網上介紹過很多方法,比如修改主機host檔案,但是要麼就是沒用,要麼就是用着用着不能用了。那麼這篇文章将徹底解決這個問題,讓你徹底愛上Github!

這篇文章轉載于 Github上一個項目:Github520

二、介紹

對 GitHub 說"愛"太難了:通路慢、圖檔加載不出來。

注: 本項目還處于測試階段,僅在本機測試通過,如有問題可以去上面說的這個項目 github520 的項目去提 issues。

本項目無需安裝任何程式,通過修改本地 hosts 檔案,試圖解決:

  • GitHub 通路速度慢的問題
  • GitHub 項目中的圖檔顯示不出的問題

花 5 分鐘時間,讓你"愛"上 GitHub。

三、使用方法

1. 複制下面的内容

# GitHub520 Host Start
185.199.108.154               github.githubassets.com
140.82.113.22                 central.github.com
185.199.108.133               desktop.githubusercontent.com
185.199.108.153               assets-cdn.github.com
185.199.108.133               camo.githubusercontent.com
185.199.108.133               github.map.fastly.net
199.232.69.194                github.global.ssl.fastly.net
140.82.114.3                  gist.github.com
185.199.108.153               github.io
140.82.114.3                  github.com
140.82.113.6                  api.github.com
185.199.108.133               raw.githubusercontent.com
185.199.108.133               user-images.githubusercontent.com
185.199.108.133               favicons.githubusercontent.com
185.199.108.133               avatars5.githubusercontent.com
185.199.108.133               avatars4.githubusercontent.com
185.199.108.133               avatars3.githubusercontent.com
185.199.108.133               avatars2.githubusercontent.com
185.199.108.133               avatars1.githubusercontent.com
185.199.108.133               avatars0.githubusercontent.com
185.199.108.133               avatars.githubusercontent.com
140.82.114.10                 codeload.github.com
52.216.104.59                 github-cloud.s3.amazonaws.com
52.216.164.131                github-com.s3.amazonaws.com
52.216.29.28                  github-production-release-asset-2e65be.s3.amazonaws.com
52.217.81.140                 github-production-user-asset-6210df.s3.amazonaws.com
52.217.80.164                 github-production-repository-file-5c1aeb.s3.amazonaws.com
185.199.108.153               githubstatus.com
64.71.168.201                 github.community
185.199.108.133               media.githubusercontent.com
# Star me GitHub url: https://github.com/521xueweihan/GitHub520
# GitHub520 Host End

           

2. 修改 hosts 檔案

hosts 檔案在每個系統的位置不一,詳情如下:

  • Windows 系統:

    C:\Windows\System32\drivers\etc\hosts

  • Linux 系統:

    /etc/hosts

  • Mac(蘋果電腦)系統:

    /etc/hosts

  • Android(安卓)系統:

    /system/etc/hosts

  • iPhone(iOS)系統:

    /etc/hosts

修改方法,把第一步的内容複制到文本末尾:

  1. Windows 使用記事本。
  2. Linux、Mac 使用 Root 權限:

    sudo vi /etc/hosts

  3. iPhone、iPad 須越獄、Android 必須要 root。

3. 激活生效

大部分情況下是直接生效,如未生效可嘗試下面的辦法,重新整理 DNS:

  1. Windows:在 CMD 視窗輸入:

    ipconfig /flushdns

  2. Linux 指令:

    sudo rcnscd restart

  3. Mac 指令:

    sudo killall -HUP mDNSResponder

Tips: 上述方法無效可以嘗試重新開機機器。