This problem has been driving me crazy for quite a while. IT happens to me infrequently enough that I never spent time to look for what exactly was going on. In my case I am using a Ubunutu VM on a MAC. I have my repo(s) checked out such that I can share them across VMs (and the MAC OS iteself). I don’t tend to attenot to do cross-platform things though. For example, my git repos folders are named for the OS I use them in so I explicitly try to assure I do not hit cross platform persistence issues.
I really think the proper thing to do is to put a .gitattibutes in place as called out in the article I linked to. Following those directions and doing a hard reset should change the CRLF to LF and then keep them that way from this point forward regardless of the environment being used.