Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / operating-systems / Windows

How to Use Git and Github for Windows from Within a Windows auth Proxy Network

0.00/5 (No votes)
9 Jan 2013Apache2 min read 13.2K  
If you work at a company where you need to type in your user id to access sites on the internet and when you want to use git to push to a repository on the internet and it just hangs, here is a solution. 

If you work at a company where you need to type in your user id to access sites on the internet and when you want to use git to push to a repository on the internet and it just hangs. This post may help you out.

While git is a nice distributed version control system (dvcs), it was not written for Windows. A side effect of this fact is that it does support using proxy servers. But it really only supports using the kinds of proxy servers one would find in environments with non Windows machines. So, this is a case where a little ingenuity goes a long way. I credit Matt Hinze for figuring all of this out. Now it is standard practice when we need to connect to remote git repositories.

In order to make git access repositories on the internet through a Windows auth proxy server, we need to add a local proxy and configure git to use the local proxy. This local proxy takes care of all the authentication so that git just works with the proxy and the proxy relays the data through the tightly controlled corporate proxy server. Let's look at a diagram of how this works.

image

The light blue box represents your machine/workstation; the red box is the corporate network; the green box represents the internet. Since git cannot send ntlm credentials to the proxy, the network traffic just dies at the proxy. With the local ntlmmapps proxy, git can communicate to it without having to send the username and password, and the ntlmmapps proxy adds that information so the corporate ntml proxy gets its credentials and passes the network traffic through to github.com.

To configure this, it's pretty simple.

  1. Download and unzip the ntmlmaps script & install python for windows (15 MB download).
  2. Open up the server.cfg in Notepad and enter the values for your proxy and network.
    1. PARENT_PROXY:
    2. PARENT_PROXY_PORT:
    3. NT_DOMAIN:
    4. USER:
    5. PASSWORD: (leave this blank, you can enter it when the proxy starts up)
    6. LISTEN_PORT:5865 ( remember this number you need it to configure git)
  3. Open the runserver.bat file in Notepad and change the following line from:
    before:c:\program files\python\python.exe” main.py
    after: C:\Python27python.exe main.py
  4. Run the runserver.bat (probably need to run it as administrator)
  5. Type in your password
  6. Configure git in a command line
    1. git config –global http.proxy http://localhost:58665

You're done, this should now push all the git commands through your local proxy which will authenticate the network calls and pass through the git commands.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0