David David - 1 year ago 136
Git Question

How to temporarily disable git http proxy

I am using git behind a corporate firewall, and I am successfully cloning external projects by using the http.proxy --global config.

My problem arises when I want to clone through http on the intranet. I suspect that the proxy config interferes with the intranet request.

I know I could reset the config before using the intranet, but that is not very user friendly.

I also saw this answer, but it seems to apply only to an existing repository.

Is there a way to deactivate the proxy usage only for one command invocation? In this case, the initial clone?

Answer Source

I always set:


(export if I am on Unix, or a simple set on Windows)

It is enough to bypass the proxy for all intranet url ending with ".mycompany".

See for an example:

I use it in my own project: .proxy.example:

export http_proxy=http://username:userpassword@server.company:port
export https_proxy=http://username:userpassword@server.company:port
export no_proxy=.company localhost