1. Generate needed ssh key
mkdir ~/.ssh chmod 700 ~/.ssh ssh-keygen -t rsa -b 4096 -C "<user>@<host> server key" -f ~/.ssh/<user>_<host>.key
2. Install ssh key on ssh server
ssh-copy-id -i ~/.ssh/<user>_<host>.key <user>@<host>
3. Create ~/.ssh/config file
cat >> ~/.ssh/config <<EOL
Host *
ServerAliveInterval 15
ServerAliveCountMax 6
Compression yes
Host <host>
HostName <host-fqdn>
Port 22
User <user>
IdentityFile ~/.ssh/<user>_<host>.key
IdentitiesOnly yes
ForwardAgent yes
# this sets up a socks5 proxy
DynamicForward localhost:1080
# this sets up a local port to forward traffic to a remote host and port
LocalForward 8080 <some-remote-host-fqdn>:80
# this sets up a remote git server accessible by ssh proxy above
#Host <remote-git-server>
# HostName <remote-git-server>
# ProxyCommand ssh <host> -W %h:%p
# IdentityFile ~/.ssh/<remote-git-server>.key
# User <remote-git-server-user>
EOL
chmod 600 ~/.ssh/*