gist.github无法访问解决方法及hosts文件格式变为.txt问题解决
1、gist.github无法访问
打开系统hosts文件,滑到最下方,回车另起一行添加以下两行内容:
192.30.253.118 gist.github.com
192.30.253.119 gist.github.com
保存后win系统打开cmd。尝试ping 192.30.253.118,如果能ping通,就可以正常访问了hosts文件路径:
win系统在c:/windows/system32/drivers/etc/hosts目录下
hosts文件打开修改方式:
右键-打开方式-记事本打开即可
或下一个Notepad++,右键-Edit with Notepad++
2、hosts文件格式问题
系统中最原始的hosts文件应为无格式文件,即名称全称为hosts,若发现为hosts.txt等带有格式后缀的文件,则按上方步骤修改内部内容不会生效,原因可能是你在之前使用过加速器或者用第三方软件修改过hosts文件导致。
此时应在电脑桌面再新建一个txt文本文档,其中复制粘贴入以下原版内容(或复制hosts.txt错误格式文件中的内容)并保存,再手动在桌面删去后面的.txt使其变成无格式文件,然后拖动至etc文件夹中选择覆盖,最后删掉一切其他带格式的hosts文件。
注:为什么不直接删去原本的.txt后缀,是因为hosts文件并不是真的没有,而是好像以某种形式还存在,显示隐藏文件也看不见的那种,当修改后缀后,系统会默认问你是不是名称要修改为host(1)。不会让你直接覆盖的。所以要在桌面上先搞一个hosts文件,然后拖拽进来,才会提示是否覆盖,选择覆盖就会生效。
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 activate.navicat.com