Windows 下 git clone无法解析域名

遇到这种情况,应该在Windows全盘搜索 hosts 文件,该文件为Windows系统盘下某个名为/etc文件夹下,注意是Windows系统盘,并不是Git软件安装位置下的/etc文件夹。
找到该文件后,一般是不允许你做修改(系统盘文件夹做了权限设置),但是可以先把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
# IP地址 域名,如下形式即可
192.168.1.1 gitlab.com

修改后可以在 cmd 窗口敲入如下命令进行测试,看看是否添加成功
即“ping 域名”

ping gitlab.com

出现正常连接结果则修改完成。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值