• 奇怪的git代理超时问题


    曾几何时在公司用代理上过网,后来在家里使用git訪问csdn code和github就出现代理超时的问题,例如以下:

    $ git clone https://github.com/bumptech/glide.git
    fatal: unable to access 'https://github.com/bumptech/glide.git/': Failed to connect to proxy.xxx.com port 8080: Connection timed out

    这个错误说明是git设置中有代理项。而在ubuntu中设置git是在~/.gitconfig中完毕的。但我不记得我设置过git的代理。


    那么是不是使用了系统的代理?
    我检查了一下,~/.bashrc中无。gui设置界面中也已经关闭。


    为了确认,我用firefox上网,并将其代理设置成使用系统代理。结果我尽管将系统设置的代理关闭。可是firefox仍然无法上网。我果断将系统设置的代理全清空。而此时firefox能够上网。可是这对git clone仍无卵用。

    几经挣扎。我决定也不按常理出牌,手动设置gitconfig的代理,将proxy设为空。

    例如以下:

    $ cat ~/.gitconfig
    [user]
        name = linc
        email = xxx@xxx.com
    [core]
        autocrlf = input
    [color]
        ui = auto
    [http]
        proxy =  
    

    果然,起作用!

    以下在ubuntu下的代理设置參考:

    git 代理:

    git config --global http.proxy 
    查询到当前设置了代理,所以我取消这个设置: 
    git config --global --unset http.proxy 
    再查询,已经没有了代理。然后再push,成功了!

    ubuntu代理:

     1.通过export http代理使用apt-get(暂时有效)
        在使用apt-get之前,在终端中输入以下命令
        export http_proxy=http://proxy_addr:proxy_port
        取消代理使用
        export http_proxy=""
     2.apt.conf文件里配置http代理信息(永久有效)
        sudo gedit /etc/apt/apt.conf在您的apt.conf文件里加入以下这行
        Acquire::http::Proxy "http://proxy_addr:proxy_port";
        保存apt.conf文件就可以
     3..bashrc文件里配置代理信息(apt-get, wget 等等)(全局有效)
        gedit ~/.bashrc.bashrc文件末尾加入例如以下内容
        export http_proxy="http://proxy_addr:proxy_port"
        保存文件。又一次开启终端。
  • 相关阅读:
    get与post的区别
    细数28个服务器端控件
    学习笔记
    是Attribute,还是Property
    学习日记
    C#常见面视题(附答案)
    扩展GridView(八)——导出为Excel
    如何实现ObjectDataSource与GridView的分页操作
    asp.net程序性能优化总结
    Array和ArrayList的异同点
  • 原文地址:https://www.cnblogs.com/lxjshuju/p/7397468.html
Copyright © 2020-2023  润新知