Take the 2-minute tour ×

As soon as I clone a certain repo on my macbook pro, I immediately see files as modified in that repo. I've tried git pull, git checkout, git reset, nothing seems to make these supposedly modified files go away. I've been using git for a while and have never seen this before. What could possibly be causing it?

share|improve this question
Are you pulling between Unix and Windows? Maybe the line endings are getting changed automatically. –  you786 Aug 30 '12 at 21:34
Like I mentioned, I'm pulling to a macbook. –  Eli Aug 30 '12 at 21:34
What does git diff tell you? –  you786 Aug 30 '12 at 21:46
A lot of: warning: CRLF will be replaced by LF in * The file will have its original line endings in your working directory. –  Eli Aug 30 '12 at 21:51

1 Answer 1

up vote 7 down vote accepted

There is a configuration file that marks certain types of source files as text, for which newlines will be converted. There's either a .gitattributes file in the root of the repository, or a global ~/.gitattributes in your home directory.

You can do two things:

  • modify the .gitattributes configuration so that files aren't marked as text anymore
  • commit the proposed changes so that the repository becomes consistent with the specification; I'd recommend this solution

I'd say that the intention was to properly let git handle newlines, so someone added the configuration in .gitattributes after some files were committed with the Windows CRLF endlines, and when that happens, git doesn't automatically fix the existing files that were already checked out in the working tree. But a new clone will get those files into the working tree anew and automatically fix them, so git will complain next time you compare the working tree with the index.

share|improve this answer
This is also described here: help.github.com/articles/dealing-with-line-endings –  you786 Aug 30 '12 at 22:24
you save my life :) –  Gelldur Feb 6 at 8:25

Your Answer


