Create a .gitattributes file in the project root containing:
* text=auto
This will result in all text files (as identified by Git) being committed with LF, but checked out according to the host operating system default.
This is equivalent to the recommended core.autocrlf defaults of:
input on Linux/macOStrue on Windows