Monday, 26 April 2010

How to Manually Build and Configure Msysgit

Up to now I have held off from putting all my code in github for one reason - I couldn't access private repositories from work because of the corporate firewall I am behind. But the introduction of Smart HTTP Support has changed that. Unfortunately I had some problems getting this working on my work PC, so I have documented the steps I had to go through for future reference.

I'm a heavy Cygwin user so I first tried to clone over https using the Cygwin version of Git. After working out that I needed to set a https_proxy environment variable (in the format username:pass@proxy-address:port) I then hit a problem whereby I couldn't specify my github password. Git prompted for a password, but for some reason wasn't accepting the input when I typed it in. Strange.

After pondering this for a while I decided that there is probably a good reason that msysgit is the recommended method for running Git on Windows, so decided to install it. However, our firewall blocks downloading .exe files. I have full admin rights on my PC, but I can't download .exes. It used to be that you could circumvent this check by adding a query string to the end i.e. some.exe?a=0 - but somewhere along the way our clever admins spotted this flaw. Since I couldn't download the .exe installer, I had to find a way to build from scratch.

The first problem was getting hold of the source code. I couldn't use Git to get it, for obvious reasons, so instead I downloaded zip archives from and (see the links in the shortlog section, for example). I unzipped the msysgit code into C:\msysgit and then unzipped the contents of the 4msysgit archive into the C:\msysgit\git directory. Building and installing was then a simple case of opening a cmd window in C:\msysgit and running msys.bat.

Then I had to add the following to my Windows path: c:\msysgit\bin;C:\msysgit\mingw\bin

I also created a quick launch shortcut with the command: /share/msysGit/add-shortcut.tcl QuickLaunch

Running git --version confirmed that git was installed correctly. I was then able to clone my private repository by:
  • Setting global git config http.sslverify = false
  • Setting the https_proxy variable
  • Running: git clone myrepo
Now that I know I can clone a private repository, and push changes to it, I am happy to use github for all my future development.

Credit Where Credit is Due...
This article proved very useful in working out what I had to do.

No comments:

Post a Comment