Getting Git to work with a proxy server - fails with “Request timed out”

前端 未结 19 2750
旧时难觅i
旧时难觅i 2020-11-22 05:09

How do I get Git to use a proxy server?

I need to check out code from a Git server, but it shows \"Request timed out\" every time. How do I get around this?

19条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 05:25

    If you are using ubuntu, then do the following ...

    Step 1 : Install corkscrew

    $ sudo apt-get install corkscrew
    

    Step 2 : Write a script named git-proxy.sh and add the following

    #!/bin/sh
    
    exec corkscrew   $*
    
    #  and  are the ip address and port of the server
    # e.g. exec corkscrew 192.168.0.1 808 $*
    

    Step 3 : Make the script executable

    $ chmod +x git-proxy.sh
    

    Step 4 : Set up the proxy command for GIT by setting the environment variable

    $ export GIT_PROXY_COMMAND="//git-proxy.sh"
    

    Now use the git commands,such as

    git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
    

提交回复
热议问题