Archive

Archive for June, 2009

Git through proxy….

June 4th, 2009 No comments

To access the Android code from my laptop at work I need to go through a proxy. I had a hard time finding info on how to use git with a proxy, but then I found this link detailing a script that uses socat to get through a proxy. The sample script they provided did half of the work of connecting to the proxy. However, it didn’t handle the authentication part. Fortunately, socat has a few more tricks up its sleeve and adding a proxyauth option handles this case as well.  Full script can be found below:

#!/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

# Configuration. Common proxy ports are 3128, 8123, 8000.
PROXY=yourproxy
PROXYPORT=8080
PROXY_AUTH=username:password

exec socat STDIO PROXY:$PROXY:$1:$2,proxyport=$PROXYPORT,proxyauth=$PROXY_AUTH

Be aware that your proxy must allow outbound connections to port 9418! If not, this script will not work

Categories: Linux Tags:
Easy AdSense by Unreal