完美解决git: Failed to connect to 127.0.0.1 port 1080: Connection refused报错问题

1.问题描述

在修改git代理后再运行git push -u origin master时出现如下问题:

git: Failed to connect to 127.0.0.1 port 1080: Connection refused

2.解决方法

网上有很多解决方法,但我在尝试的时候运行并没有反映。后来经过尝试后发现如何有效地利用这些方法解决这个问题。
网上方法:

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

这个我在终端运行时并没有反映,经尝试后我发现只有在git的仓库位置(初始化的位置)运行才会取消gitconfig中的http.proxy=127.0.0.1:1080或者https.proxy=127.0.0.1:1080。

我的Git初始化位置在public目录下,于是我运行git config --list后果然发现存在代理问题(而你在其他位置运行就不会显示这个代理),所以在public目录下运行以上方法即可成功解决。
在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44547510/article/details/118457285