From the link VonC gave to this question, I was able to put together the correct commands to get this done, but those answers are very convoluted (and sometimes difficult to understand the correct syntax), so I thought I would consolidate my answer here for posterity:
Solution 1: Only apply the proxy to external site
One solution is to setup only github.com for the proxy with:
> git config --global http.https://github.com.proxy http://[user:pass@]<proxy URL>:<port>
> git config --global https.https://github.com.proxy http://[user:pass@]<proxy URL>:<port>
This looks a little funky because you are embedding https://github.com
right in the middle of the normal http.proxy
statement. This is how you create a proxy that is attached to a specific site.
Solution 2: Apply proxy to all, but remove it for internal site
Alternately, you can configure the proxy for all sites, then remove the proxy just for your internal Github site:
> git config --global http.proxy http://[user:pass@]<proxy URL>:<port>
> git config --global https.proxy http://[user:pass@]<proxy URL>:<port>
This applies the proxy to everything, and then do the following to tell Git to not use a proxy for your internal Git site:
> git config --global http.<Git Site URL>.proxy ""
> git config --global https.<Git Site URL>.proxy ""
where <Git Site URL>
is the fully qualified domain name, such as http://github.mycompany.com
- what you would type into the browser to get there.
Notes
- The proxy address must be
http://proxy:port
, and not https://proxy:port
(i.e. just http
, NOT https
), for both http.proxy
and https.proxy
.
- There are other potential solutions, such as setting the proxy only for certain local repos, but not globally, or only setting the proxy for a given remote (say you have a repo with 2 remotes, one is external and the other internal), but I will leave those for the reader to determine...