Wednesday, October 19, 2011

Using GIT under HTTP PROXY

If you want to use git command under http proxy, you can use this way:

  1. Install socat
    $sudo apt-get install socat

  2. Create configuration file which match with your proxy server address and port under /bin
    #!/bin/sh
    # Use socat to proxy git through an HTTP CONNECT firewall.
    # Useful if you are trying to clone git:// from inside a company.
    # Requires that the proxy allows CONNECT to port 9418.
    #
    # Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
    # chmod +x gitproxy
    # git config --global core.gitproxy gitproxy
    #
    # More details at http://tinyurl.com/8xvpny
    
    # Configuration. Common proxy ports are 3128, 8123, 8000.
    _proxy=172.17.0.18
    _proxyport=8080
    
    exec socat STDIO PROXY:$_proxy:$1:$2,proxyport=$_proxyport

  3. Now git command should work in your network under http proxy
    $git config --global core.gitproxy gitproxy

2 comments:

  1. By way of example, a marriage in Thailand must be registered with the civil registrar, the Amphur. A religious ceremony alone does not create a valid marriage in Thailand. Thus, although a religious ceremony may be sufficient to register a marriage in certain states in the United States.

    ReplyDelete
  2. I would like to consider the chance of saying thanks to you for that professional guidance I have constantly enjoyed going to your site. I'm looking forward to the actual commencement of my university research and the general preparation would never have been complete without dropping by your blog. If I can be of any assistance to others, I'd personally be happy to help by what I have gained from here.

    ReplyDelete