• git clone 如何通过proxy进行远程代码仓库拷贝下载


    git使用proxy的方式和ssh的情况是差不多的,给出借鉴:

    SSH如何通过proxy进行服务器连接

    ----------------------------------------------------------------------------------------------------

    假设代理服务器proxy的IP和端口为:

    192.168.1.103:1080

    假设要下载的代码仓库地址:

    https://gitee.com/devilmaycry812839668/scalable_agent

    -----------------------------------------

    在不使用proxy的情况下,可以有下面两种方式下载该仓库:

    1. 通过http或https协议

    git clone https://gitee.com/devilmaycry812839668/scalable_agent

    2. 通过git协议

    git clone git@gitee.com:devilmaycry812839668/scalable_agent

    -----------------------------------------

    设置proxy:

    1. 为通过http或https协议方式设置proxy:(其中可以再分为http/https代理和sock5代理)

    http/https代理

    git config --global http.proxy   http//192.168.1.103:1080

    git config --global https.proxy https://192.168.1.103:1080

    取消代理:

    git config --global --unset http.proxy

    git config --global --unset https.proxy

    sock5代理

    git config --global http.proxy  'socks5://192.168.1.103:1080'

    git config --global https.proxy 'socks5://192.168.1.103:1080'

    该种方式,对于git clone 后面的网址进行dns时不对dns服务进行代理

    git config --global http.proxy  'socks5h://192.168.1.103:1080'

    git config --global https.proxy 'socks5h://192.168.1.103:1080'

    该种方式对dns查询同样使用代理(如果本地主机不能连接因特网,那么必须使用该命令)

    取消代理:

    git config --global --unset http.proxy

    git config --global --unset https.proxy 

    上面的方式都是为永久设置,设置后如果想取消必须手动进行取消操作。

    2. 为通过git协议方式设置proxy

    命令demo:(git协议需要在对应的网站上配置公钥)

    git clone git@gitee.com:devilmaycry812839668/scalable_agent ProxyCommand='nc -x 192.168.1.103:1080 %h %p'

    使用代理所需参数:

    ProxyCommand='nc -x 192.168.1.103:1080 %h %p'

     

    gitee网站上配置公钥的教程:

    生成/添加SSH公钥

    ========================================================

    参考:

    https://gist.github.com/coin8086/7228b177221f6db913933021ac33bb92

    https://blog.csdn.net/sunjinshengli/article/details/108862226

  • 相关阅读:
    【Redis】事务
    【Web】Apache HttpClient & HttpAsyncClient
    【Spring】导入配置文件
    【SpringBoot】@Conditional注解家族
    【前端开发】dva+antd+react
    【Spring】EnableXXX
    POJ-2240-Arbitrage
    POJ-2387-Til the Cows Come Home
    hdu-1847-畅桶工程续
    Floyd算法模板(多源最短)
  • 原文地址:https://www.cnblogs.com/devilmaycry812839668/p/16805976.html
Copyright © 2020-2023  润新知