解决 git Failed to connect to 127.0.0.1 port xxxx: Connection refused

504 阅读1分钟

原因

这种情况一般是有代理,我遇到的就是安装 PHP 的 composer 导致代码无法提交

解决方式

git config --global http.proxy

## 有没有呢,有就取消

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

## 有没有呢,有就取消

git config --global --unset https.proxy
## 查下代理

env|grep -i proxy

## 有没有呢,有就取消

unset http_proxy

unset https_proxy

## 再查询

env|grep -i proxy

## 果然没有了
## 但还是没法提交代码,查看环境变量,删除 http_proxy 和 https_proxy,完美解决

吐槽

PHP 的 composer 垃圾中的战斗机,国人赶快转行吧。