I would like to access (clone/push/pull) a private (via ssh) git repository while behind a corporate firewall that only allows http proxy access. I have written a robust Java (d
Can you get a normal ssh (command-line) session going? If so, git should also work.
When using ssh, git should pick up your configuration options in .ssh/config. If that is not enough, you can point the environment variable GIT_SSH at a modified version of ssh (or shell script wrapper).
Using socat
and a .ssh/config
like this:
Host=foo.server.com
ProxyCommand=socat - PROXY:your.proxy.ip:%h:%p,proxyport=3128,proxyauth=user:pwd
You should be able to ssh
to foo.server.com
and
git clone ssh://foo.server.com/var/git/myrepo.git
is expected to work.
This is my setup working under a Linux machine (localhost on port 18081 is a proxy).
cat ~/.ssh/config
Host github.com
User git
ProxyCommand nc -x localhost:18081 -Xconnect %h %p