zoukankan      html  css  js  c++  java
  • Git配置代理

    命令行中进行配置

    http://stackoverflow.com/questions/783811/getting-git-to-work-with-a-proxy-server

    Command to use :

    git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080
    
    • change proxyuser to your proxy user
    • change proxypwd to your proxy password
    • change proxy.server.com to the URL of your proxy server
    • change 8080 to the proxy port configured on your proxy server

    If you decide at any time to reset this proxy and work without (no proxy):

    Commands to use:

    git config --global --unset http.proxy
    

    Finally, to check the currently set proxy;

    git config --global --get http.proxy

    配置好之后,就可以正常进行fetch了,配置的时候,最好加上http:// 。  目前gcm还不支持不带http的,

    https://gist.github.com/evantoli/f8c23a37eb3558ab8765

    git config --global http.proxy sasygsha01prx11_p.asnet.accorservices.net:8080

    http.proxy后面的url,最好加上http://,否则在credential manager中会报错。参考这个issue

    TortoiseGit中进行配置

    Bypass的使用

    场景:需要使用proxy访问github,但同时又需要访问内网部署的git server。但是proxy是无法访问内网的

    https://stackoverflow.com/questions/19523903/how-to-temporarily-disable-git-http-proxy

    I always set:

    no_proxy=.mycompany
    

    (export if I am on Unix, or a simple set on Windows)

    It is enough to bypass the proxy for all intranet url ending with ".mycompany".

    在环境变量中配置no_proxy,用英文的逗号分隔开

    需要注意的是,no_proxy暂时不支持通配符,比如172.31.*

    有人提示可以使用这种方式来bypass一组ip, 

    https://unix.stackexchange.com/questions/23452/set-a-network-range-in-the-no-proxy-environment-variable

    1) Add each IP in full:

    printf -v no_proxy '%s,' 10.1.{1..255}.{1..255};
    export no_proxy="${no_proxy%,}";

    结论

    https://github.com/git-for-windows/git/issues/2074

    https://curl.haxx.se/libcurl/c/CURLOPT_NOPROXY.html

    1.The only wildcard available is a single * character, which matches all hosts, and effectively disables the proxy.

    2.You could list them individually:

     The string consists of a comma separated list of host names that do not require a proxy to get reached, even if one is specified.

    3.if you can use a domain name:

    If the name in the noproxy list has a leading period, it is a domain match against the provided host name. This way ".example.com" will switch off proxy use for both "www.example.com" as well as for "foo.example.com".

    多个ip的话,每个ip对应一个不同的domain,但是这些domain都是以.example.com结尾的。

    4.Alternatively, you can configure `git config http.proxy ""` for all remotes in a repository, or finer-grained `git config http.<url>.proxy ""` for individual remotes (identified by their ).  这个感觉不太实用。

  • 相关阅读:
    算法
    数据结构
    数据表与简单java类(一对多)
    引用传递
    二叉排序树 C++
    二叉树 C++
    基数排序
    快速排序
    堆排序
    归并排序
  • 原文地址:https://www.cnblogs.com/chucklu/p/5309891.html
Copyright © 2011-2022 走看看