git repo gives contradictory info from WSL than from Windows git repo gives contradictory info from WSL than from Windows git git

git repo gives contradictory info from WSL than from Windows


The two git installations (native windows and WSL) are using a different setting for the core.autocrlf configuration, because these two installations are not using the same global config file.

Put simply, the native windows client is converting LF to CRLF upon checkout, and hence the presence of CRLF is not "seen" as a change by git status. On the contrary, the WSL client expects UNIX-style LF line endings, so the git status sees every file as having been modified to change LF to CRLF.

Instead of relying on the global setting the core.autocrlf you should set it locally in the repository for any shared repositories. If the same repository is being accessed from both Linux/WSL and native Windows, you probably want this set to false so git does not change any line endings at all. Just beware that if you do set this as false, you'll have to make sure your editors can handle the line endings as they are (in general, most programmers editors I've used do support using UNIX LF, even on Windows).

The core.autocrlf is documented here for more info:

https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_core_autocrlf


This could have something to do with WSL reporting the permissions of all files on the Windows filesystem as being 777. Git then regards all files as changed because their permissions are different.

Try changing the Git configuration so that permission changes are ignored:

# For the current repositorygit config core.filemode false   # Globallygit config --global core.filemode false

See: https://github.com/microsoft/WSL/issues/184