git无法clone项目连接失败(设置代理)

产生原因

代理服务器
就是你的电脑和互联网的中介。当您访问外网时(如http://google.com) , 你的请求首先转发到代理服务器,然后代理服务器替你访问外网,并将结果原封不动的给你的电脑,这样你的电脑就可以看到外网的内容。

路径如下:
你的电脑->代理服务器->外网
外网->代理服务器->你的电脑

很多朋友配置代理之后,可以正常访问github 网页了,但是发现在本地克隆github仓库(git clone xxx)时还是报网络错误。

那是因为git clone 没有走你的代理,所以需要设置git走你的代理才行。

设置代理

git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy https://127.0.0.1:7890

Git 查看现有配置

git config --global -l

取消代理

git config --global --unset http.proxy
git config --global --unset https.proxy

猜你喜欢

转载自blog.csdn.net/Xiang_Gong_Ya_/article/details/131511592