git clone https://github.com/istester/ido.git ,确提示“Failed to connect to 192.168.1.22 port 8080: Conn...

本文介绍了在尝试git clone时遇到错误「Failed to connect to 192.168.1.22 port 8080: Connection refused」的解决过程。通过检查和修改git配置,发现并移除了错误的代理设置,从而成功克隆了仓库。此外,还分享了如何正确设置git代理的方法。

 

 

不知道是否有同学遇到如下的问题:

git clone https://github.com/istester/ido.git    #一个git仓库。

 

确收到如下报错:

Cloning into 'hosts'...

fatal: unable to access 'https://github.com/racaljk/hosts.git/': Failed to connect to 192.168.1.22 port 8080: Connection refused

 

如上,明明clone的github仓库代码,为何会收到无法链接内网的错误呢 ?

网上找了很多帖子,没啥直接的答案。

 

解决思路:

猜测是git的配置问题,先看看git的所有配置信息

git config --list

可以显示所有的配置信息。

[Ido-Air:gitHome idoxu$ git config --list

credential.helper=osxkeychain

color.ui=true

user.name=Ido

user.email=957863300@qq.com

http.proxy=http://192.168.1.22:8080/

https.proxy=http://192.168.1.22:8080/

core.excludesfile=/Users/idoxu/.gitignore_global

difftool.sourcetree.cmd=opendiff "$LOCAL" "$REMOTE"

difftool.sourcetree.path=

mergetool.sourcetree.cmd=/Applications/SourceTree.app/Contents/Resources/opendiff-w.sh "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED"

mergetool.sourcetree.trustexitcode=true

core.repositoryformatversion=0

core.filemode=true

core.bare=false

core.logallrefupdates=true

core.ignorecase=true

core.precomposeunicode=true

 

如上,确实有http://192.168.1.22:8080/的配置信息,问题定位到。

那么,如何去掉配置呢 ?

 

原来是设置了代理。

去掉代理即可。

git config --global --unset http.proxy

git config --global --unset https.proxy

 

如上,搞定,再次 git clone ,代码可正常down下来。

 

 

延伸,既然涉及到了git的代理,那么作为好奇心,以及强烈学习欲望的tester ,必须得了解下如何设置代理。

git 代理设置方法:

git config --global http.proxy http://192.168.1.22:8080/

git config --global https.proxy https://192.168.1.22:8080/

 

如果需要用户名和密码

git config –global http.proxy http://user:password@10.167.32.133:8080

git config –global http.proxy https://user:password@10.167.32.133:8080

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IDO老徐

转发 + 讨论 > 赞赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值