'git shows files as modified right after a clone

I cloned a repo and following the clone I have a bunch of files (but not all) marked as modified (according to git status).

A git diff on any of the files shows that all lines will be deleted and all lines will be added (but no differences - all the lines are identical)

If I do git diff --ignore-all-space it shows no differences. Which leads me to believe it's a line endings issue.

But when I open the files in, say NotePad++, I see the correct CRLF characters at the end of each line (I am in a Windows env so I want CRLF at repo level and local level).

In my .gitattributes file I have an entry (I don't want git to do anything with my files):

* -text

So why are some files appearing as modified ?

git


Solution 1:[1]

I would suggest setting the config to handle this for you. This should autoconvert it so handles the translation between windows and unix without it looking like every file is touched.

git config --global core.autocrlf true

Here is documentation that explains it in detail.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dan Csharpster