preface

Before, I found that GitHub avatars were always split and could not be loaded. At first, I thought it was because I opened the ladder, and I didn’t care much about it. When I looked at the issue, the problem was that the avatars could not be loaded. But all the pictures can not load out, 😂! That makes a big difference. So there will have all sorts of baidu | | Google found some post doesn’t work, also good finally found a useful posts, operation steps are as follows:

Operation method

Methods a

  • 1. Find the hosts file Windows:

    C:\Windows\System32\drivers\etc\hosts
    Copy the code

    Mac:

    command + shift + g # Open to
    Copy the code

    Input/etc/hosts

  • 2. Modify the host file

    The # v1 online solution is still working140.82.112.113.3 gist.github.com 185.199.108.153 assets-cdn.github.com 199.232.68.133 Raw.githubusercontent.com 199.232.68.133 199.232.68.133 gist.githubusercontent.com cloud.githubusercontent.com 151.101.192.133 151.101.184.133 camo.githubusercontent.com avatars.githubusercontent.comUse Spaces between IP addresses and domain names, and separate domain names with Spaces.
    # eg: 199.232.68.133 avatars0.githubusercontent.com... avatars8.githubusercontent.com
    
    Copy the code

Method 2

  • Modify rules by ladder agent (operate according to your own agent client, the principle is basically the same)

    ||raw.githubusercontent.com
    ||.githubusercontent.com
    ||githubusercontent.com
    ||.githubassets.com
    ||githubassets.com
    Copy the code

It is better to teach a man to fish than to give him fish

The above results are found through Google baidu, but sometimes GitHub’S IP address changes (I did once or twice) and the above configuration is invalid. So you have to Google Baidu again. In that case, it is better to know how to solve the problem.

  • Use a third-party tool to query information

    ipaddress.com/

    Through this platform we can easily check the corresponding domain name corresponding IP address.

    Such as I am using the domain name raw.githubusercontent.com is more, because I use making mechanism, created a figure bed project, all pictures of access should be accessed through the domain name. So it is very likely that others in the preview of the domain under the picture, picture resources failed to load!

    # by above may know, raw.githubusercontent.com corresponding to four IP address
    185.199.108.133
    185.199.109.133
    185.199.110.133
    185.199.111.133
    Copy the code
  • Example Change the host file information

    
    # GitHub Start
    
    # according to the domain name https://www.ipaddress.com/ to check the IP address
    
    # v1 (previous Google search)
    140.82.112.4 github.com
    199.232.68.133 raw.githubusercontent.com
    
    # v2 (configure it yourself by following the above link)
    140.82.113.3 github.com
    # Mygraph is under this domain
    185.199.108.133 raw.githubusercontent.com
    185.199.109.133 raw.githubusercontent.com
    185.199.110.133 raw.githubusercontent.com
    185.199.111.133 raw.githubusercontent.com
    # User profile picture
    
    # GitHub End
    Copy the code

conclusion

In fact, the failure to load GitHub resources was mainly caused by the fact that these resources were blocked on the extranet due to the mainland policy. So through the above explanation, I think that if this kind of resource loading failure occurs again in the future, I can easily solve similar problems.

The resources

Solve the problem that github images are not displayed · Zhihu