Git through digest proxy authentication

Viewed 35718

I want to do "git clone" through a proxy server. The issue is my proxy server uses digest authentication. So i can't find neither in git documentation, nor help that someone that already made.

I dig through google search and i can't find any helpful results.

Thxs.

6 Answers

Using

git config --global http.proxy

or more in general, if the user or password has any special char like "$\" etc you gotta url encode it making then something like: %24%5C

hope this will help as I usually get mad about this...

Git does not appear to support authenticated proxy servers. You can check http.c from the git.git repository; in order to support authenticated proxy servers at all, it would have to set CURL_PROXYUSERPWD to set the username and password, but that string does not appear in that file.

One possible solution would be to fix Git; add a few more configuration parameters to http.c, such as http.proxyuser, http.proxypass, to set the username and password for the proxy, and http.proxyauth to set the authentication method, and then pass those in as the appropriate cURL configuration options.

If you don't feel like hacking on the Git source code, you could set up your own, local proxy server, that needs no authentication, and then forward from that to the proxy server that requires authentication. Squid supports this mode of operation, though the configuration can be a little complex; I found an example configuration that purports to demonstrate this setup, though I haven't verified that it works myself.

edit: Never mind, after checking the Squid source code, it appears to only support Basic authentication, not Digest authentication, when forwarding requests to a peer:

httpHeaderPutStrf(hdr_out, header, "Basic %s", base64_encode(orig_request->peer_login));

I haven't found any proxy servers that can pass a request along to another proxy with digest authentication enabled; if you can find one that supports digest auth for an upstream proxy, I'd recommend using that.

Otherwise, I'd recommend using a different protocol than HTTP; use ssh: if you need authentication, or the raw git: protocol if you're just pulling changes down from a public server.

Related