1: Background. I win7, the back end is Win10, using the Tortoisegit tool. I use SSH and he uses HTTP. Warehouse is on Linux, using Gitlab management
2: The problem. The warehouse was built before the director. Back end of the file after the add push, I clone the local after not put into the editor and do not make any changes, immediately commit, prompt all files have been modified, open contrast, only the end of the line has changed
3: Difference. Because I have not encountered such problems before, I do not know where to start, just began to think that it is a coding problem, Baidu after Google did not know why, from the code to git version with the elimination of the one by one contrast, and finally found that we 2 people connection way inconsistent. Unified the link way, the problem does not exist, but this is not the fundamental solution to the problem, at first thought is the problem caused, in fact, is not, just blind cat hit dead mouse, in fact, one of the terminal reinstall Git used the same AUTOCRLF
4: Summary. This is the problem with Git's line break in Windows and Linux, Autocrlf is not the same in Windows and Linux. This problem occurs when different terminal submissions use different newline characters.
5: Solve.
A, installation time, most of the options are the default installation, so in the AUTOCRLF option, the general is also the default.
However, when multi-person collaborative development, different terminal different git configuration, will cause 2 of the problem
The installation time can choose this, checkout does not modify the file newline character, commit does not modify the file line feed character
b, if there are 2 problems.
If your source file is LF, and autocrlf=true, git add will encounter FATAL:LF would is replaced by CRLF error. There are two solutions:
1. Convert lf in your source file to CRLF "recommended"
2. Set Autocrlf to False
If you have a newline character in your source file that is CRLF, and autocrlf=input, git add will also encounter Fatal:crlf would be replaced by LF error. There are two solutions:
1. Convert the CRLF in your source file to LF "recommended"
2. Set Autocrlf to True or false
Set Autocrlf = input on the Mac, set Autocrlf = True on Windows (the default value).
git in window and Linux line break problems