Thanks a lot to text producers. I’ve just copied it here to promote them.
Making the ssh tunnel
Option 1: ssh and direct connect (SOCKS5) : The following line will start the ssh client and connect to username@remote_machine.com. Port 8080 on localhost (127.0.0.1) will listen for requests and send them to the remote machine. The remote machine will then send the packets out as if they originated from itself. The ssh options are in the man page of ssh, but to summarize them in order: Compression, SSH2 only, Quite, Force pseudo-tty allocation, Redirect stdin from /dev/null, and Place the ssh client into “master” mode for connection sharing.
ssh -C2qTnN -D 8080 username@remote_machine.com
Option 2: ssh to squid proxy (HTTP/SSL Proxy) : The following line will also start the ssh client and connect to username@remote_machine.com. Port 8080 on localhost (127.0.0.1) on the current machine will listen for requests and ssh tunnel them to the remote machine. On the remote machine ssh will forward the packets to localhost port 2020. If squid is listening on localhost port 2020 on the remote machine then all requests sent though the ssh tunnel will then be forwarded to squid. You can use squid to block ads and speed up web access. If you need assistance with squid, check out the Calomel.org Squid “how to” page.
ssh -C2qTnN -L 8080:localhost:2020 username@remote_machine.com
Using GIT through a SOCKS proxy
user@debian-machine:~$ cat /somepath/bin/proxy-wrapper
# on Debian systems you will need netcat-openbsd package in order this options to work
nc -xPROXYMACHINE:PORT -X5 $*
user@debian-machine:~$ export GIT_PROXY_COMMAND=”/somepath/bin/proxy-wrapper”
user@debian-machine:~$ git clone git://git.debian.org/git/debian-eeepc/eeepc-acpi-scripts.git
Initialized empty Git repository in /blableblubla/codigo/git/eeepc-acpi-scripts/.git/
remote: Counting objects: 1050, done.
remote: Compressing objects: 100% (554/554), done.
remote: Total 1050 (delta 572), reused 848 (delta 475)
Receiving objects: 100% (1050/1050), 115.39 KiB | 37 KiB/s, done.
Resolving deltas: 100% (572/572), done.