Skip to content


Switching from Cygwin to MSysGit – Git Thinks Everything Has Been Modified :-(

Introduction

I’ve been dabbling with git lately, contributing to the Nancy project, and I’ve been happily working away using Cygwin, which I already had installed, and all was fine and dandy. Things went slightly awry, however, when I decided to give MSysGit a whirl. Typing “git status” on my (unmodified) repository, that I’d previously used with Cygwin, showed every single file as modified.. argh!

Faking FileModes

A quick “git diff” showed this output for every file:

old mode 100755
new mode 100644

A brief Google later and it turns out that MSysGit “fakes” filemodes (unix permissions – the 755/644 part of the log above), whereas Cygwin, which is a more “complete” Linux implementation on Windows, does them “properly”. Now, by default, git tracks the filemode and considers it a change whenever it’s modified, so the “fake” modes coming back from MSysGit were making everything appear modified.

Solution

Luckily, the solution is very simple – tell git to stop tracking filemodes! I set this as a global option, but also had to set it on the repository too as it has a default value set in there. The following two commands sorted it out:

git config --global core.filemode false
git config core.filemode false

Conclusion

A simple fix to a, potentially, obscure problem; but I think if you’re using msysgit to work on non-Windows projects, that may have filemodes set for executable scripts, then this workaround may be required too. Apparently MSysGit does attempt to fake the filemode based on file extension, so things that *look* like they should be executable are faked to have +x, but it’s not going to be perfect.

Share:
  • Twitter
  • DotNetKicks
  • DotNetShoutout
  • Google Bookmarks
  • Digg
  • del.icio.us
  • Live
  • Technorati
  • StumbleUpon
  • email
  • Netvibes
  • Ping.fm
  • Print
  • Reddit

Technorati Tags: , ,

Posted in Misc, Rambling.

Tagged with , , .


5 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. anand says

    Thank you so much for this post. You saved my day!

  2. sabgenton says

    One question.
    Why go to msysgit if Cygwin is so full featured?

  3. blackstrype says

    You’re my hero, Steven Robbins! I’ve been developping in a dual-boot environment (Windows 7 with WUBI), and the switch from Windows to Ubuntu was constantly a pain. It took me a long time to realize the difference between this file mode issue and the similar issue of CRLF vs LF. Many thanks :)

  4. cyborgtroy says

    I’ve heard this can also be fixed by doing a “git clone” from msysgit. For some reason, when the initial clone is done from msysgit, cygwin and msys are able to cooperate.

    I have tried this just now with one of my work repositories, and it appears to work.

Continuing the Discussion

  1. Switching from Cygwin to MSysGit – Git Thinks Everything Has Been Modified :-( linked to this post on 19/01/2011

    [...] and all was fine and dandy. Things went slightly awry, however, when I decided to give… [full post] Steven Robbins GrumpyDev miscramblingcygwingit 0 0 0 0 [...]



Some HTML is OK

or, reply to this post via trackback.