Git temporary removal of http.proxy

I almost always work behind a firewall and use the http proxy that is installed in my global git configuration. From time to time, I get stuck in a public place outside the firewall and return to a non-lifestyle. This means that my browser should not use a proxy server, etc. Etc., Which I must cancel as soon as I return to a safe place and fun in a convenient place.

I want to make one click or commit / click with git outside the firewall, but I do not want to remove proxy settings from the configuration, because in an hour I will just add it back. I want something like

git -c http.proxy="" pull

or

git --unset http.proxy pull

so that I can just do it one time without a proxy. But the first leads to error: Missing value for 'http.proxy', and the second is not a valid syntax.

So the question is:

How to disable http.proxy for just one click?

+3
source share
1 answer

The best solution for this would be to write two batch files with one proxy server parameter and the other where you canceled the proxy server. Before requesting pull, you can run the batch file to suit your needs.

You can install the Git proxy using the command below in Git bash. Set for HTTP and HTTPS proxies.

git config --global http.proxy http://username:password@proxy.server.com:8080
git config --global https.proxy http://username:password@proxy.server.com: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 disable the Git proxy, run the following commands in Git bash. Git config --global --unset http.proxy Git config --global --unset https.proxy

Tick How to configure Git proxies and How to disable Git Proxies for more details.

0
source

All Articles