Git under WSL shows all files as modified

Tobias Etzold • August 9, 2022

git linux wls

Caused by different line endings, there is a chance that git under WSL falsely flags files as modified. Under Linux there is typically LF als line ending where under Windows CR+LF is beeing used. To test this, simply run the following command in your console. The option -w tells git diff to ignore whitespaces and line ending normalization.

git diff -w

When there are no differences found, the following command should help you. With it you can set git to always use CR+LF in the global config file.

git config --global core.autocrlf true

If this does not help there is another possible issue, that could cause trouble. This has something to do with the file permission modes. To test this, use the following command inside your project folder.

git diff

This shows you the current differences in your files. When you see there the filename which has differences followed by the following statement, there is indeed a problem with the file permission mode.

old mode 100755 
new mode 100644

All you need to do is tell git to ignore the file permission mode. This can be done with the following command.

git config core.filemode false