我打开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通(也就是连不上,虽然我网页可以打开)
- 真正的解决方案:
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