Tuesday, 16 December 2008

accessing Github from behind HTTP proxy

When you need to pull or push from Github (git://) and you're behind corporate HTTP firewall, you might find below instructions helpful:

1. set environmental variables (in .bashrc or .bash_profile)
export GIT_SSH="${HOME}/bin/http-ssh"
export GIT_PROXY_COMMAND="${HOME}/bin/http-cmd"

2. prepare http-ssh and http-cmd in your ${HOME}/bin/ directory (or any other of your choice -> just adjuct the environmental variables accordingly)
#!/bin/sh
# Filename: http-ssh
ssh -o ProxyCommand="${HOME}/bin/http-cmd %h %p" $@

#!/bin/sh
# Filename: http-cmd
/usr/bin/connect -H http://<your_http_proxy>:<port> $@


now you can freely use git command.

No comments: