When ever I'm commiting something to git it gives me the warning
"The file will have its original line endings in your working directory"
How can I avoid this?
My setup is a Linux Debian VM (VirtualBox) hosted on a Windows 10 machine. I develop in PHPStorm from my Windows and all files are in a shared folder that the VM has access to. I commit my files from SSH on my VM.
Emil Moe
Senior Data Engineer
Sai Kishore Komanduri
Engineering an eGovernance Product | Hashnode Alumnus | I love pixel art
This happens because of how
gitdeals with line endings differently on different operating systems. Because you're developing on a Windows system; the line endings are generallyCRLF; but when the code is committed into the repository the line endings are changed toLF.You can use the following (often recommended) command to change the default behaviour of git:
git config --system core.autocrlf falseWhat this essentially does is, it tells git to not worry about line endings at all; and it would be your responsibility to keep it all in check.
Also do note that
autocrlfhas no saying in the files that have already been committed. The changes that are in your repo, are going to stay that way.You can read more about
autocrlfhere. Hope this helps! :)