Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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:

  • Getting git to work with a proxy server

  • How do I pull from a Git repository through an HTTP proxy?

but the above questions make no mention of PAC scripts.

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

like image 733
nitin3685 Avatar asked May 20 '16 09:05

nitin3685


People also ask

How do I use Git behind proxy?

Setting the proxy for Git Run the following commands replacing USERNAME , PASSWORD , PROXY_ADDRESS , and PROXY_PORT with your network's information: git config --global --add http. proxy http://USERNAME:PASSWORD@PROXY_ADDRESS:PROXY_PORT.

How do I read a proxy PAC file?

PAC files are typically hosted on a web server and are named proxy. pac. Since PAC files contain the configuration in plain text. You can use a text editor, such as Microsoft Notepad or Apple TextEdit to view or modify the files.


1 Answers

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.

like image 64
VonC Avatar answered Sep 22 '22 06:09

VonC