Files showing as modified directly after a Git clone

Sam Elliott picture Sam Elliott · Feb 15, 2011 · Viewed 91.3k times · Source

I'm having an issue with a repository at the moment, and though my Git-fu is usually good, I can't seem to solve this issue.

When I clone this repository, then cd into the repository, git status shows several files as changed. Note: I haven't opened the repository in any editor or anything.

I tried following this guide: http://help.github.com/dealing-with-lineendings/, but this didn't help at all with my issue.

I have tried git checkout -- . many times, but it seems not to do anything.

I'm on a Mac, and there are no submodules in the repository itself.

The filesystem is "Journaled HFS+" filesystem on the Mac and is not case-sensitive. The files are one-line and about 79 KB each (yes, you heard right), so looking at git diff isn't particularly helpful. I have heard about doing git config --global core.trustctime false which might help, which I will try when I get back to the computer with the repository on it.

I changed details of filesystem with facts! And I tried the git config --global core.trustctime false trick which didn't work very well.

Answer

adnans picture adnans · Apr 28, 2012

I had the same problem on the Mac after cloning a repository. It would assume all files had been changed.

After running git config --global core.autocrlf input, it was still marking all files as changed. After looking for a fix I came across .gitattributes file in the home directory which had the following.

* text=auto

I commented it out and any other cloned repositories from now on were working fine.