Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can we configure the .pac proxy to git #5516

Closed
pallipavan opened this issue Aug 30, 2018 · 7 comments
Closed

How can we configure the .pac proxy to git #5516

pallipavan opened this issue Aug 30, 2018 · 7 comments

Comments

@pallipavan
Copy link

I cannot fetch or pull or push in my corporate network
Corporate network is configured with .pac file

let me know which command i can use to configure .pac proxy for git
Tried this command git config --global http.proxy http://pac.zscalertwo.net/XXXXXX/global-pac.pac

But it didn;t worked out

Appreciated for reply

@steveward
Copy link
Member

Thanks for opening this @pallipavan! Git needs to know the PROXY_SERVER and PORT variables, so linking directly to your .pac file will unfortunately not work. I found a useful command to query the registry and return the proxy server/port your .pac file is using:

  1. Launch the command prompt (cmd.exe)
  2. Run the command reg query “HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings” | find /i “proxyserver”

That should hopefully return the information you need to then configure your proxy in Git:

git config --global http.proxy http://proxy.server.com:8080

Replace http://proxy.server.com:8080 with the URL and port of your proxy. Let me know if that doesn't get things working.

@pallipavan
Copy link
Author

i am able to get the proxy server and it started working fine for me
Thanks @steveward for your quick help

@prafullsurana
Copy link

My case is similar with some variance:

  1. When i run the visual studio 2017 in my laptop; connecting to my office via vpn and using proxy as .pac file - i am able to clone the repo
  2. I have remote desktop where visual studio 2017 has been installed and using the same proxy settings (.pac file). Here when i am trying to clone the repo i get 443 time out error.

What could be the reason for this??

When i update the gitconfig ("C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\etc"), in remote desktop, with proxy setting (http://proxyserver:8080) it works though i do not want to have manual setting done and expecting it to work the way it works in my office laptop

@steveward
Copy link
Member

@prafullsurana how are you specifically using the .pac file on your laptop? Are you pointing to it in your .gitconfig? Git needs to get your proxy server and credentials from either the proxy config in the .gitconfig file or the HTTP_PROXY environment variable.

@prafullsurana
Copy link

No, Its there in internet explorer's LAN Settings. Same has been set in Virtual Desktop. BTW HTTP_PROXY environment variable has not been set in both.
In virtual machine source repository is accessible via internet explorer, also from the visual studio it is connected. But cloning does not work.

@escapin
Copy link

escapin commented Mar 24, 2022

Thanks for opening this @pallipavan! Git needs to know the PROXY_SERVER and PORT variables, so linking directly to your .pac file will unfortunately not work. I found a useful command to query the registry and return the proxy server/port your .pac file is using:

1. Launch the command prompt (cmd.exe)

2. Run the command `reg query “HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings” | find /i “proxyserver”`

That should hopefully return the information you need to then configure your proxy in Git:

git config --global http.proxy http://proxy.server.com:8080

Replace http://proxy.server.com:8080 with the URL and port of your proxy. Let me know if that doesn't get things working.

immagine

It doesn't really work for me. I just have the proxytm.pac available. Any idea how to solve it?

@dkipping-mio42
Copy link

dkipping-mio42 commented Aug 3, 2022

Very belated answer @escapin , but maybe helpful to others: you can open the .pac file (proxytm.pac in your case) with the browser by inserting the http address to the .pac file as a URL and analyze the content of the file. It should reveal the possible proxies including address and ports as well as the decision logic on when which proxy is to be used.

In case your proxy configuration depends on the network you are currently using, it might be using IP-ranges.
You can then check your own IP addres in the terminal with ipconfig (windows) or ifconfig (linux/mac) and deduce, which proxy you should be using as a parameter for git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants