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

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo }
span.s1 { }

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的所有配置信息

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo }
span.s1 { }

git config --list

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

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo }
span.s1 { }

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

credential.helper=osxkeychain

color.ui=true

user.name=Ido

user.email=ido@yunlai.cn

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/的配置信息,问题定位到。

那么,如何去掉配置呢 ?

原来是设置了代理。

去掉代理即可。

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo }
span.s1 { }

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/

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px "PingFang SC"; color: #454545 }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #454545 }

如果需要用户名和密码

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

git clone https://github.com/istester/ido.git ,确提示“Failed to connect to 192.168.1.22 port 8080: Connection refused” 的解决办法 。的更多相关文章

  1. git时 Failed to connect to 127.0.0.1 port 1080: Connection refused

    在公司换了一台电脑之后发现git clone 和 npm install都失败,报错为 fatal: unable to access 'https://github.com/netease-im/N ...

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

    某天,用git拉取,提交代码的时候出现了git Failed to connect to 127.0.0.1 port xxxx: Connection refused的问题, 开始百度,看了一通.都 ...

  3. git clone Failed to connect to 127.0.0.1 port 43213: Connection refused

    不知道为什么使用git clone 的时候报了上面的错误,后面发现是 127.0.0.1 port 43213的端口被代理占用了,可以这样查看: $ env|grep -i proxy 结果是: NO ...

  4. 解决GitHub push项目——Push failed: Unable to access 'https://********.git/': Failed to connect to 127.0.0.1 port 1080: Connection refused

    解决方法: 第一步:在git中设置http代理 git config --global http.proxy 第二步:在git中取消http代理 git config --global --unset ...

  5. git clone时报错“Failed to connect to 127.0.0.1 port 2453: Connection refused”如何处理?

    1. 查看git的配置 git config --global --list| grep -i proxy 如果有内容输出,那么unset配置项,如: git config --global --un ...

  6. 【git使用】Failed to connect to 127.0.0.1 port 1080: Connection refused

    查询是否使用代理:git config --global http.proxy 取消代理:git config --global --unset http.proxy

  7. Git 拉取Gitee仓库报错:“fatal: unable to access ''": Failed to connect to 127.0.0.1 port 1080: Connection refused”

    1.报错信息: 2.本地查看是否Git使用了代理 git config --global http.proxy 3.取消代理 git config --global --unset http.prox ...

  8. linux centos7 “git clone https://github.com/XXXXX” 报错解决方法

    2021-08-04 1. 问题描述 在执行以下命令时出现错误"正克隆到 'XXXXX'... fatal: unable to access 'https://github.com/lag ...

  9. Get https://192.168.2.119/v2/: dial tcp 192.168.2.119:443: getsockopt: connection refused

    Get https://192.168.2.119/v2/: dial tcp 192.168.2.119:443: getsockopt: connection refused

随机推荐

  1. Objective-C 实用关键字详解1「面试、工作」看我就 🐒 了 ^_^.

    在写项目 或 阅读别人的代码(一些优秀的源码)中,总能发现一些常见的关键字,随着编程经验的积累大部分还是知道是什么意思 的. 相信很多开发者跟我当初一样,只是基本的常用关键字定义属性会使用,但在关键字 ...

  2. C#代码将html样式文件转为Word文档

    首先有个这样的需求,将以下网页内容下载为Word文件. html代码: <div class="modal-body">    <div style=" ...

  3. HttpClient研究学习总结

    Http协议非常的重要,HttpClient相比传统JDK自带的URLConnection,增加了易用性和灵活性(具体区别,日后我们再讨论),它不仅是客户端发送Http请求变得容易,而且也方便了开发人 ...

  4. AOJ/数据结构习题集

    ALDS1_3_A-Stack. Description: Write a program which reads an expression in the Reverse Polish notati ...

  5. [Git]07 如何在提交过程中忽略某些文件

     一般我们总会有些文件无需纳入 Git 的管理,也不希望它们总出现在未跟踪文件列表.通常都是些自动生成的文件,比如日志文件,或者编译过程中创建的临时文件等.我们可以创建一个名为 .gitignor ...

  6. linux系统中.bashrc的妙用

    一.有何作用 .bashrc - The individual per-interactive-shell startup file. .bashrc - 主要保存个人的个性化设置,如命令别名.路径等 ...

  7. macOS 中使用 phpize 动态添加 PHP 扩展的错误解决方法

    使用 phpize 动态添加 PHP 扩展是开发中经常需要做的事情,但是在 macOS 中,首次使用该功能必然会碰到一些错误,本文列出了这些错误的解决方法. 问题一: 执行 phpize 报错如下: ...

  8. oracle表信息

    获取表: select table_name from user_tables; //当前用户的表 select table_name from all_tables; //所有用户的表 select ...

  9. ACE框架 同步原语设计

    ACE框架常用的同步机制设计成统一的原语接口.同步原语使用系统平台(操作系统,多线程库)提供的同步原语,并为系统平台不提供的同步原语提供模拟实现.ACE框架使用了外观模式和适配器分两层,将同步原语统一 ...

  10. rabbitmq安装Management Plugin

    运行和安装Rabbitmq Management的步骤如下: 1.进入Rabbitmq安装目录,运行rabbitmq-plugins enable rabbitmq_management 2.运行ra ...