If you set a global proxy in Gnome (I'm not sure about other desktop environments), you'll notice that the terminal ignores it. Here's how to set a proxy for the terminal:
For a HTTP proxy, simply run the following command in a terminal:
For a secure connection (HTTPS), use:
Obviously, replace everything with your username, password, proxy ip and port. If the proxy does not require an username and password, you can skip the "YOUR_USERNAME:YOUR_PASSWORD@" part.
Here is an example. Using TOR (installation instructions for Ubuntu 10.10), to set a HTTP and HTTPS proxy for the current terminal session, run:
export http_proxy='http://localhost:8118' export https_proxy='http://localhost:8118'
Note that if you close the terminal (or terminal tab where you've ran these commands), the proxy will not work anymore. To make these changes permanent, add these commands to your ~/.bashrc file.
How to check if the terminal proxy is workingTo see if the proxy you've just set actually works, run the following command (firstly, make sure you have curl installed: sudo apt-get install curl):
Yes, a funny domain name but it does the job =)
The above command should return your new IP (if you don't know your initial IP, firstly run the curl command, then set the proxy and finally run the curl command again to see if the proxy works).
Reset the proxy
If you want to unset a proxy, you can simply close the terminal or alternatively, run the following commands:
unset http_proxy unset https_proxy
See also: how to get GIT working behind a firewall (use it if the GIT port is blocked by your ISP/network admin).