Short tip: Clone Git repository via SSH and SOCKS proxy
When using tools such as GitLab can cloned via HTTP and SSH. Especially the second choice can be handy if there is no VPN available - but keep in mind, also sending DNS via the jumphost.
The first step is establishing a SSH connection leveraging port forwarding:
1$ ssh -A -D 1337 USER@IP -i pinkepank.key
Afterwards, http://localhost:1337 can be used as SOCKS proxy verwenden - web servers in the remote networks should be accessable including DNS.
Cloning the Git repositories is done with an customized http configuration:
1$ git -c http.proxy=socks5h://localhost:1337 clone http://gitlab.pinkepank.remote-site.org/group/repo.git
Notice the socks5h
protocol - the following protocols are supported:
Parameter | Explanation |
---|---|
socks4:// |
SOCKS4 proxy, DNS resolution via client |
socks4h:// |
SOCKS4 proxy, DNS resolution via remote system |
socks5:// |
SOCKS5 proxy, DNS resolution via client |
socks5h:// |
SOCKS5 proxy, DNS resolution via remote system |
To ensure that you don't need to override the configuration every time, you can set the proxy on repository or global level (--global
):
1$ git config http.proxy socks5h://localhost:1337