Pretty much all the dev team work on a mac environment except one! No rewards for guessing that its mine which differed from everyone else's. I occasionally use my Windows 7 box to do some development and commit to repo.
We opted to use git for this project and I have to say that the first few days were quite challenging to use git in the way its meant to be used. But after few hiccups we got the hang of it. I initially had some trouble setting up git on my windows m/c to behave the same way as on my mac. When I did a clone for a git repository a whole bunch of 'Modified' files showed up when I ran 'git status'. After some googling and tweaking the core.autocrlf setting to 'true/false/input', I got it working right. All the 'Modified Files' list disappeared. But recently I decided to look around for git clients for windows and installed git extensions and smartgit. But something changed and when I did a clone, the dreaded 'Modified Files' reared its head again! I thought "Ah! Thats a cakewalk. I know what to do" and started changing my core.autocrlf setting.. but nothing changed. When you run 'git config -l', you might see a bunch of core.autocrlf entries.. I ran the following to make sure every core.autocrlf entries are set to false:
> git config -l
> git config --global core.autocrlf false
> git config core.autocrlf false
> git config --system core.autocrlf false
Followed by
> git reset --hard
> git status
I still kept getting the 'Modified Files'. Strangely, when I ran the 'git status' from cygwin, it was fine. It showed no modified files. Cygwin git was 1.6.x version, whereas the one run from MingW was 1.7.4
After an invisible hand slapped the back of my head, I realized that I could run diff to see what the changes were.
> git diff
This showed that the file contents were fine.. it was the mode that was the problem.
All the files showed the following:
old mode 100755 (rwx r-x r-x)
new mode 100644 (rw- r-- r--)
Not sure why it decided to do that, but changing the core.filemode solved this problem.
> git config core.filemode false
So when you run into a 'Modified Files' issue, make sure you check the setting for
core.autocrlf
core.safecrlf
core.filemode
Good Luck!
No comments:
Post a Comment