Is there any way to get git to work directly with a .pac (proxy auto-config) script?

nitin3685 picture nitin3685 · May 20, 2016 · Viewed 12.4k times · Source

My corporate network works with a PAC script.(http://proxyconf.xxx.yy-ss/proxy.pac).

Using the PAC script in the "git config" command does not work. "git config --global http.proxy http://proxyconf.xxx.yy-ss/proxy.pac"

I got it to work by downloading the proxy.pac script (100 odd entries), selecting the most generic (usually the bottom most) proxy, and using it with my credentials in the "git config --global http.proxy" command.

I have already asked about making git work through a proxy server:

but the above questions make no mention of PAC scripts.

Is there some setting with which I can directly use the proxy.pac script?

Answer

VonC picture VonC · Nov 22, 2016

You would need to configure git and make it reference your own proxy server, one using your PAC file.

See for instance liangqing/PacProxy

A socks proxy server that use PAC file to decide how to forward request

Features

  • Implement a socks server(support socks4 and socks5, no authentication module)
  • Using PAC file to decide how to forward request

As mentioned in "Using a socks proxy with git for the http transport", you need to configure git as:

git config --global http.proxy 'socks5://127.0.0.1:9999'

No need to configure https.proxy: this does not exist in the Git codebase.