完全解决git clone超时和git子模块无法下载问题

1. 解决git clone 连接超时的问题

国内可用的镜像网站有:

https://github.com.cnpmjs.org
# 服务器位于香港

https://gitclone.com
# 服务器位于杭州

https://doc.fastgit.org
# 服务器位于香港

例如:将

git clone https://github.com/XXXXX

修改为

git clone https://gitclone.com/github.com/XXXXX

即可正常下载。

2. 解决下载子模块失败的问题

执行 git submodule update --init --recursive
提示 fatal: unable to connect to github.com:

执行命令:

git config --global url.https://github.com/.insteadOf git://github.com/

即可正常下载子模块。

可使用 vim ~/.gitconfig (linux)或~/.gitconfig (windows)命令即可查看gti配置文件。

[filter "lfs"]
	clean = git-lfs clean -- %f
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true
[user]
	name = xxx
	email = [email protected]
[url "https://github.com/"]
	insteadOf = git://github.com/

猜你喜欢

转载自blog.csdn.net/qq_45906972/article/details/142214187