git clone拒绝访问的解决

网上说原因是git被配置了代理,首先查看git代理设置
git config --global -l

报错:fatal: unable to read config file '/home/felix/.gitconfig': No such file or directory

如果不报错就删除~/.gitconfig文件中"https_proxy=..."整行的语句

上面的命令没解决就查看环境变量中有没有设置代理接口的:

env|grep -i proxy

输出为:felix@felix-go:~$ env | grep -i proxy
NO_PROXY=localhost,127.0.0.0/8,::1
http_proxy= 365855
https_proxy= 365855
HTTPS_PROXY=365855
no_proxy=localhost,127.0.0.0/8,::1
HTTP_PROXY=

http_proxy= " "
https_proxy= " "
HTTPS_PROXY=" "

根据上面的输出使用unset命令删除这个代理,例如删除第二个

unset http_proxy
删完那三个之后我重新打开一个终端,还是拒绝访问,所以只能修改环境变量了:
gedit ~/.bashrc

然后在里面加入:

http_proxy=" "
https_proxy= " "
HTTPS_PROXY=" "
再source ~/.bashrc 就好啦!

猜你喜欢

转载自blog.csdn.net/m0_38082419/article/details/80003614
今日推荐