Friday, October 18, 2013

How to use Git behind a Proxy Requiring NTLM Authentication

  1. Download NTLM Authorization Proxy Server.
    This is proxy that you'll run locally between Git and the real proxy. It will handle the NTML authentication so that Git doesn't have to.
  2. Edit the ntlmaps config file to point to your server.
    The path for this file is "C:\Program Files (x86)\ntlmaps\server.cfg" on my PC. You need to set PARENT_PROXY, PARENT_PROXY_PORT, NT_DOMAIN and USER at a minimum. It's best to leave PASSWORD blank so that you're prompted for it when the ntlmaps is run.
  3. Run the ntlmaps using the ntlmaps.cmd script included.
  4. Configure git to use the ntlmaps proxy. (This assumes that you're running it on the default 5865 port.)
    These commands will update your global settings:
    git config --global http.proxy http://localhost:5865
    git config --global https.proxy http://localhost:5865
That's it! Git should be access external repositories now.

From a security point of view, ntlmaps probably isn't the kind of thing you want to run all the time. I start it up whenever I need to pull or push and turn it off afterwards.