解决方案
1.使用GitHub的镜像网站。网上可以找到的镜像地址有:
现在能用的只剩这个了,下面的不用看了
https://github.91chi.fun/https://github.com
fastgit.org
https://doc.fastgit.org/
cnpmjs.org
https://github.com.cnpmjs.org/
gitclone
https://gitclone.com/
2.设置git config
(设置的是用户配置文件:~/.gitconfig
):
git config --global http.postbuffer 1048576000
git config --global http.sslVerify false
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999
PS:第二种方法我测试了基本没用。
使用镜像地址替换GitHub的方式
方法一:将github.com
替换为镜像地址(推荐使用fastgit)
#原命令
git clone https://github.com/huaweicloud/huaweicloud-sdk-java-v3.git
#github.91chi.fun
https://github.91chi.fun/https://github.com/huaweicloud/huaweicloud-sdk-java-v3.git
#github.com.cnpmjs.org
git clone https://github.com.cnpmjs.org/huaweicloud/huaweicloud-sdk-java-v3.git
#hub.fastgit.org
git clone https://hub.fastgit.org/huaweicloud/huaweicloud-sdk-java-v3.git
#gitclone
https://gitclone.com/github.com/huaweicloud/huaweicloud-sdk-java-v3.git
方法二:修改配置文件
git config --global url."https://github.91chi.fun/https://github.com".insteadOf https://github.com
或直接修改~/.gitconfig
文件:
[url "https://hub.fastgit.org/"]
insteadOf = https://github.com/
PS:以上配置仅对HTTPS
有效,SSH
时需要将代理取消:
git config --global --unset url.https://github.com/.insteadof
参考
https://note.qidong.name/2020/12/github-proxy/
https://blog.csdn.net/networken/article/details/105122778