无法连接到git远程存储库 [英] Unable to connect to git remote repository
问题描述
执行git push -u origin master
之后,我得到了:
fatal: unable to access 'https://github.com/xxxx/xxxx.git': Failed to connect to 127.0.0.1 port 8087: Connection refused
当我也尝试克隆其他存储库时,发生了相同的错误.
Same error occurred, when I tried to clone other repositories, too.
8087端口似乎并不繁忙.怎么可能出问题了?
The Port 8087 doesn't seem to be busy. What could go wrong?
修改:
当我从git://
而不是https://
克隆时,效果很好.
when I do clone from git://
instead of https://
, it works just fine.
推荐答案
发生这种情况是因为在git中配置了代理.
This happens because a proxy is configured in git.
因为它是https代理(而不是http),所以git config http.proxy
和git config --global http.proxy
不能帮助您.
Since it's https proxy (and not http) git config http.proxy
and git config --global http.proxy
can't help.
git config --global -l
如果您没有与https_proxy=...
之类的https代理相关的问题,则问题不在这里.
If you have nothing related to https proxy like https_proxy=...
the problem is not here.
如果您有与https代理相关的内容,请从文件~/.gitconfig
中将其删除,然后重试
If you have something related to https proxy then remove it from the file ~/.gitconfig
and try again
检查环境变量:
env|grep -i proxy
您应该使用https_proxy=...
使用:逐一取消设置:
unset https_proxy
(或HTTPS_PROXY,具体取决于变量名称)
Unset one by one with :
unset https_proxy
(or HTTPS_PROXY depending of the name of the variable)
env|grep -i proxy
如果什么都没显示,那你应该很好.
If it shows nothing you should be good.
注意:此解决方案可以应用于http和https代理问题.只是变量名称从https更改为http
Note : This solution can applies to http and https proxy problems. just the variables name changes from https to http
这篇关于无法连接到git远程存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!