window10下用git bash下载package:能够网页访问github但是使用git bash here却无法把package下载下来

我打开git bash here后,想git clone某一包:

Andy Wu@DESKTOP-UPVFGB6 MINGW64 /g/OneDrive - stu.hit.edu.cn/桌面/xiaolai.github.io-master/the-self-cultivation-of-leeks
$ git clone https://github.com/10179013/the-craft-of-selfteaching

然后报错:

error: RPC failed; curl 28 OpenSSL SSL_read: Connection was reset, errno 10054
fatal: expected flush after ref listing

解决方法:
1.初始化git仓库(新的没有执行过git命令的文件夹,这一步必须要,已有.git目录的跳过)

git init

2.执行命令:

git config --global http.sslVerify "false"

然后我再次git clone 我想下载的包,

Andy Wu@DESKTOP-UPVFGB6 MINGW64 /g/OneDrive - stu.hit.edu.cn/桌面/xiaolai.github.io-master/the-self-cultivation-of-leeks
$ git clone https://github.com/10179013/the-craft-of-selfteaching/tree/by-jiasheng.tutorial
Cloning into 'by-jiasheng.tutorial'...

结果报新错:

fatal: unable to access 'https://github.com/10179013/the-craft-of-selfteaching/tree/by-jiasheng.tutorial/': Failed to connect to github.com port 443 after 21102 ms: Timed out

查阅网上博客,有说是设置代理的,但是这个方法没解决我的问题:

git config --global --unset https.proxy

结果再次git clone https://github.com/10179013/the-craft-of-selfteaching Cloning into 'the-craft-of-selfteaching'...

又报错:error: RPC failed; curl 28 OpenSSL SSL_read: Connection was reset, errno 10054 fatal: error reading section header 'shallow-info'

然后我想,有可能是电脑IP地址的问题,于是我: ping github.com

Andy Wu@DESKTOP-UPVFGB6 MINGW64 /g/OneDrive - stu.hit.edu.cn/桌面/xiaolai.github.io-master/the-self-cultivation-of-leeks
$ ping github.com

Pinging github.com [20.205.243.166] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 20.205.243.166:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

果然,无法ping通(也就是连不上,虽然我网页可以打开)

  1. 真正的解决方案:

ping github.com 超时,网上查找解决方案如下:
1.查询github.com 的IP点击这里(其实就是在你想查的网站后面输入.ipaddress.com/:例如 http://github.com.ipaddress.com/)
在这里插入图片描述

2.修改本机 C:\Windows\System32\drivers\etc 文件下的 hosts文件,具体修改为:
在文件末尾添加 : 140.82.114.3 github.com 保存 .(140.82.114.3是我的IP,你要改成自己的)
由于hosts文件受到系统保护,你无法直接打开,你可以根据一下方式修改:
1、打开“运行”对话框(可以直接使用Win+R组合快捷键,快速打开),然后键入hosts文件路径:C:\WINDOWS\system32\drivers\etc 完成后,点击下方的“确定”打开,如图。(必须要通过这个方式(相当于是赋予了管理员权限)打开文件夹,否则是无法将文件属性修改为可编辑的)
在这里插入图片描述
2、找到hosts文件所在位置后,不要直接去修改该文件,不然会出现权限不足,无法修改的问题。具体方法是,在hosts文件上点击鼠标右键,在弹出的选项中,点击打开“属性”,如图。
在这里插入图片描述
依次点击下面三个:在这里插入图片描述
然后勾选修改限权:在这里插入图片描述
然后就可以右键用记事本打开文件了
在这里插入图片描述
在文件末尾添加 : 140.82.114.3 github.com 保存在这里插入图片描述
然后我再git bush下ping github.com,现在就成功了:

Andy Wu@DESKTOP-UPVFGB6 MINGW64 /g/OneDrive - stu.hit.edu.cn/桌面/xiaolai.github.io-master
$ ping github.com

Pinging github.com [140.82.114.4] with 32 bytes of data:
Reply from 140.82.114.4: bytes=32 time=234ms TTL=39
Reply from 140.82.114.4: bytes=32 time=233ms TTL=41
Reply from 140.82.114.4: bytes=32 time=233ms TTL=41
Reply from 140.82.114.4: bytes=32 time=233ms TTL=41

Ping statistics for 140.82.114.4:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 233ms, Maximum = 234ms, Average = 233ms

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大家好我是家盛

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值