git cannot clone or push? failed to connect, connection refused

Problem

After git push -u origin master I got:

fatal: unable to access ‘https://github.com/xxxx/xxxx.git’: Failed to connect to 127.0.0.1 port 8087: Connection refused

same error happen when I try to clone others repo.

port 8087 doesn’t seem to be busy. What could go wrong?

edit: when I do clone from git:// instead of https://, it works just fine.

Solution

This happens because a proxy is configured in git.

Since it’s https proxy (and not http) git config http.proxy and git config --global http.proxy can’t help.

1 : take a look at your git configuration
git config --global -l
If you have nothing related to https proxy like https_proxy=… the problem is not here.

If you have something related to https proxy then remove it from the file ~/.gitconfig and try again

2 : if it still doesn’t work, unset environment variables
Check your environment variables :

env|grep -i proxy
You should have one or several lines with https_proxy=…

Unset one by one with : unset https_proxy (or HTTPS_PROXY depending of the name of the variable)

3 : check environment variables again
env|grep -i proxy

If it shows nothing you should be good.

Note : This solution can applies to http and https proxy problems. just the variables name changes from https to http

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值