Reputation: 750
I almost always work behind a firewall and use an http proxy, which is set in my global git configuration. Now and then I'm stuck in a public location outside the firewall, and revert to a non-proxy lifestyle. This means telling my browser not to use the proxy, etc., etc., which I have to undo once I'm back safe and snug in a friendly location.
I want to do a single pull, or commit/push with git outside the firewall, but I don't want to delete the proxy setting from the configuration, because an hour from now I will just have to add it back again. I want to so something like
git -c http.proxy="" pull
or
git --unset http.proxy pull
so that I can just do the pull this one time without the proxy. But the first one results in error: Missing value for 'http.proxy'
and the second is not a valid syntax.
So the question is:
How do I unset http.proxy for just one pull?
Upvotes: 10
Views: 4507
Reputation: 1335
The Best solution for this would be to write two batch file with one proxy setting and other where you unset the proxy. Before the pull request you can run the batch file according to your need.
You can set the Git proxy using the below command in the git bash. Set for both HTTP and HTTPS proxy.
git config --global http.proxy http://username:[email protected]:8080
git config --global https.proxy http://username:[email protected]:8080
//Replace username with your proxy username
//Replace password with your proxy password
//Replace proxy.server.com with the proxy domain URL.
//Replace 8080 with the proxy port no configured on the proxy server.
To unset the Git proxy run the below commands in the Git bash. git config --global --unset http.proxy git config --global --unset https.proxy
Check How to configure Git proxy and How to unset the Git Proxy for more details
Upvotes: 1