Skip to content

Instantly share code, notes, and snippets.

@rtfpessoa
Forked from sit/gitproxy-socat
Last active August 11, 2019 06:42
Show Gist options
  • Save rtfpessoa/dde6e3e834a24f9ae9741a5ff8abb37b to your computer and use it in GitHub Desktop.
Save rtfpessoa/dde6e3e834a24f9ae9741a5ff8abb37b to your computer and use it in GitHub Desktop.
Wrappers around socat and netcat to use git behind a proxy
# Use netcat to proxy git ssh through a proxy.
# Useful if you are trying to clone ssh:// from inside a company.
#
# Save this file as `~/.ssh/config`
#
# See http://www.emilsit.net/blog/archives/how-to-use-the-git-protocol-through-a-http-connect-proxy/ for Emil Sit's original HTTP proxy script.
# See http://www.jones.ec/blogs/a/entry/using_git_through_a_socks/ for updated SOCKS version.
#
ProxyCommand nc -x 10.0.0.84:1986 %h %p
#!/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 git-http-proxy-socat somewhere in your path (e.g., /usr/local/bin) and then run
# chmod +x git-http-proxy-socat
# git config --global core.gitproxy git-http-proxy-socat
#
# More details at http://www.emilsit.net/blog/archives/how-to-use-the-git-protocol-through-a-http-connect-proxy/
# Configuration. Common proxy ports are 3128, 8123, 8000.
_proxy=10.0.0.84
_proxyport=3128
_user=codacy
_passwd=codacy2016
exec socat STDIO PROXY:$_proxy:$1:$2,proxyport=$_proxyport,proxyauth=$_user:$_passwd
#!/bin/sh
#
# Use socat to proxy git through a SOCKS proxy.
# Useful if you are trying to clone git:// from inside a company.
#
# Save this file as git-socks-proxy-socat somewhere in your path (e.g., /usr/local/bin) and then run
# chmod +x git-socks-proxy-socat
# git config --global core.gitproxy git-socks-proxy-socat
#
# See http://www.emilsit.net/blog/archives/how-to-use-the-git-protocol-through-a-http-connect-proxy/ for Emil Sit's original HTTP proxy script.
# See http://www.jones.ec/blogs/a/entry/using_git_through_a_socks/ for updated SOCKS version.
#
# Configuration.
_proxy=10.0.0.84
_proxyport=1986
_user=codacy
exec socat STDIO SOCKS:$_proxy:$1:$2,socksport=$_proxyport,socksuser=$_user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment