git clone慢、pip install慢解决方法

仅为个人学习记录使用
环境:Ubuntu20.04LTS

git clone失败:

一,加大缓存区

git config --global http.postBuffer 524288000

这个大约是500M
二、少clone一些,–depth 1

git clone https://github.com/xxx/xxxx.git  --depth 1

–depth 1的含义是复制深度为1,就是每个文件只取最近一次提交,不是整个历史版本。
三、换协议
clone http方式换成SSH的方式,即 https:// 改为 git://
例如git clone https://github.com/test/test.git
换成git clone git://github.com/test/test.git
四:使用http取代https

若git clone 报错:

gnutls_handshake() failed: Error in the pull function.

或报错:

Failed to connect to github.com port 443: Connection refused

尝试了大部分网上的方法都失败了,包括以上的方法以及这个方法,这个方法中的查询Github的IP的网站,可以通过ping github.com代替

没想到再各种方法都尝试无果的情况下,通过多尝试了几次成功了
花里胡哨一顿操作,不如多给他一次机会(头)

pip install 慢:
1.换源

pip install -i 源 包名

国内源:
中国科技大学: https://pypi.mirrors.ustc.edu.cn/simple/

阿里云: http://mirrors.aliyun.com/pypi/simple/

豆瓣(douban): http://pypi.douban.com/simple/

清华大学: https://pypi.tuna.tsinghua.edu.cn/simple/

中国科学技术大学 :http://pypi.mirrors.ustc.edu.cn/simple/

转自
(个人觉得第一个科大的源速度很快)

2.增加等待时间

pip install -i 源  --default-time=100 包名

你可能感兴趣的:(debug,git)