Skip to content

Instantly share code, notes, and snippets.

@koffeinfrei
Last active August 29, 2015 14:02
Show Gist options
  • Save koffeinfrei/82cac4b6b35c33fc4d53 to your computer and use it in GitHub Desktop.
Save koffeinfrei/82cac4b6b35c33fc4d53 to your computer and use it in GitHub Desktop.
git through proxy
  1. install socat

  2. add git-proxy to your path (e.g. cp git-proxy ~/bin/)

  3. make git-proxy executable (e.g. chmod u+x git-proxy)

  4. add ssh config ssh_config entries to your ssh config (samples for github)

  5. edit the proxy address in git-proxy

  6. edit the proxy address in ssh_config

  7. add git configuration

    needed for ssh urls that require a login (git@github.com:someone/something.git)

    git config --global core.gitproxy git-proxy

    needed for git urls that don't require a login (git://github.com/someone/something.git)

    git config --global url.https://github.com/.insteadOf git://github.com/

  8. you can now clone the github repo with the git address

#!/bin/sh
_proxy=proxy_address
_proxyport=8080
exec socat STDIO PROXY:$_proxy:$1:$2,proxyport=$_proxyport
Host github.com
User git
Port 22
Hostname github.com
TCPKeepAlive yes
ProxyCommand socat STDIO PROXY:proxy_address:%h:%p,proxyport=8080
Host ssh.github.com
User git
Port 443
Hostname ssh.github.com
TCPKeepAlive yes
ProxyCommand socat STDIO PROXY:proxy_address:%h:%p,proxyport=8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment