Git and Windows Vista

I recently started using Git, the version control system now used for developing the Linux Kernel. While there is no native support for Windows at the moment, you can install it using cygwin. While this works reasonably well in Windows XP, I got into severe troubles when trying the same in Windows Vista.

First, I ran into troubles installing cygwin. I figured out, that it seems to work well if you run both the installer and bash in “Windows XP SP2 compatibility mode”. I needed to adjust the file system permissions of the cygwin folder to give me write permissions, though. (Note: you have to manually install the TK-libs if you want the GUI elements of git to work.)

But Git kept failing with “access denied” messages when trying to commit from command line. The failure message said it was denied access to git-update-index. I soon found out this is due to the “User Account Control” (UAC) default behavior of auto-detecting installers and prompting if you want to execute them with raised privileges. You can see if this is the case by running git-update-index manually from bash; if you get the UAC confirmation dialog you have this problem. It seems the substring “update” triggers this behavior. As the git-update-index is launched by git commit, it won’t display the confirmation dialog of Vista, so the execution will be denied.

There are two possible workarounds:

  • Run bash with administrative privileges (not recommended!)
  • Disable the auto-detection of installers by UAC.

I used the latter way. You can disable the auto-detection by following these instructions. Brief summary:

  • Open the Local Security Policies
  • Disable “User Account Control: Detect application installations and prompt for elevation”
  • Reboot (the security policy will not be updated before!)

It should work now. You can confirm this by running git-update-index manually again. If you do not get the UAC confirmation dialog now, it worked. Try git commit now, and verify it is working. Of course, you will from now on have to right-click and “Run as Administrator” every installer you want to install, as most installers will require administrative privileges.

Update 2007-08-22: Reader EGarcia posted an interesting comment below: using the Microsoft Manifest Tool you can add an according manifest to the git-update-index.exe and git-update-ref.exe

Update 2009-02-12: Reader Kevin Broadey points out the best solution so far: create a seperate .manifest file for the affected files. He has provided an example for git-update.exe.manifest.

13 thoughts on “Git and Windows Vista”

  1. You’re a lifesaver. Thank you sir. In my setup, I didn’t get the confirmation dialog at all, just a straight permission denied error whether I went through git commit or straight through git-update-index.exe

    Everything else matched your description.

  2. Glad I could help you.
    It might be that I got the confirmation dialog because I start bash in Windows XP SP2 compatibility mode. But this is just a blind guess. I will have to check one day. 😉

  3. After sharing your interest in ‘git’, reading your article and rejecting all solutions you presented, I wanted to share a solution which worked for me. Using Microsoft’s Manifest Tool, I added a manifest to git-update-index.exe which eliminated my git + UAC: ‘Permission denied’ problems.

  4. Hi,

    I just ran into this post, not sure if it’s fixed. What I did was to run cygwin on my non-OS partition (ie. D:\ or E:\) and it works for me. Vista is VERY protective of its OS partition and file operations there by “guests” are not welcomed. I didn’t need to do anything to my UAC (it’s still running), etc.

    Hope this would help someone… 🙂

  5. Hmm, maybe this was udpated in Vista with SP1? The detection of installers was revised as far as I read on the net, so this would have an effect on your observation. Being on the system partition or not should have no effect on the UAC being triggered by setup programs.

    Thanks for sharing your observation!

  6. You can create a separate git-update-index.exe.manifest file in your /usr/sbin/git-core directory rather than messing with the Microsoft Manifest tool. The file below works for me. You will need to create similar files for git-update-index.exe and git-update-server-info.exe too.

    Don’t assume I have god-like powers – I found this solution elsewhere on the internet (okay, Google found it for me!)

    The important bit is setting requestedExecutionLevel level=”asInvoker” which side-steps Vista’s automatic installer detection heuristics.

    Here’s an article about installer detection – http://msdn.microsoft.com/en-us/library/bb756960.aspx

    And here’s a link to the XML manifest format – http://msdn.microsoft.com/en-us/library/bb756929.aspx

  7. Just an FYI for anyone that runs into this: if you create the .manifest and still get “permission denied” or “This operation requires elevation” when running the cygwin executable, “touch” the executable to change its modification date. It seems the executable’s .manifest (or lack thereof) gets cached– even across a reboot for me.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.