Configuring line endings treatment
There are things about text files that normal people aren't even aware of. For starters, any character in a text file is represented as a set of numbers when saved on your hard drive. A line break, the thing that you see after you hit the Enter key, is technically also a character, and thus also represented as a number. However, through the years, operating systems such as Windows, Linux or macOS have been representing the line break in files as different numbers.
To this day it remains a source of confusion. Say, you created a file on Linux and sent it to your friend, who uses Windows. All they see is a solid wall of text, because Windows doesn't recognize Linux's line breaks.
When it comes to Git, this problem becomes critical, because multiple people may work on the same files, using different operating systems. The most common workaround is to let people work with their files as usual, but when saving to a repository, make all line endings uniform (e.g. Linux-like).
If you really want to understand what's going on with these settings, it's always better to read the documentation on core.autocrlf
and core.safecrlf
.
Please follow the instructions below, depending on your operating system. You're using Linux .
The --global
option sets the default Git settings used in repositories on your computer. However, these values can be overridden per repository—just run the needed git config
without the --global
option while being in the repository you want to adjust.
Set your line ending treatment configuration.