How do I pull from a Git repository through an HTTP proxy?

后端 未结 28 2239
星月不相逢
星月不相逢 2020-11-22 11:57

Note: while the use-case described is about using submodules within a project, the same applies to a normal git clone of a repository over HTTP.

I have

28条回答
  •  不思量自难忘°
    2020-11-22 12:13

    For me what it worked was:

    sudo apt-get install socat
    

    Create a file inside your $BIN_PATH/gitproxy with:

    #!/bin/sh 
    _proxy=192.168.192.1 
    _proxyport=3128 
    exec socat STDIO PROXY:$_proxy:$1:$2,proxyport=$_proxyport
    

    Dont forget to give it execution permissions

    chmod a+x gitproxy
    

    Run following commands to setup environment:

    export PATH=$BIN_PATH:$PATH
    git config --global core.gitproxy gitproxy
    

提交回复
热议问题