Git is written in mind with 3 different config files:
- System wide config
- User wide config
- Second user wide config
- Local repo config
Notice: the following tutorial assumes that you have your proxy configuration have saved inside you global or user specific config, like the OP has.
Removing Proxy from our already existing repo
We can remove the proxy inside our existing corporate repositories by simple cd-ing to the directory and running:
git config --local --add http.proxy ""
This will set the proxy to an empty string, what git uses to specify that a direct communication is made.
Cloning a repo without a proxy
This situation is trickier because we need to Unset the proxy, clone, and reconfigure the proxy. For this purpose, we can write a simple bash script called "proxyless-clone" (name does not really matter) that does these steps:
#!/bin.sh
http_proxy=$(git config http.proxy)
https_proxy=$(git config https.proxy)
git config --global --unset http.proxy
git config --global --unset https.proxy
git clone "$1"
git config --global http.proxy "$http_proxy"
git config --global https.proxy "$https_proxy"
This script still has a few "problems", namely that 2 instances cannot run at the same time without messing up the git config files (see it as a threading bug), but for something and 1-shot only thing like cloning, I don't think that will be a problem.